Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31839 > unrolled thread
| Started by | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| First post | 2015-06-22 13:35 -0400 |
| Last post | 2015-06-28 20:09 -0400 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: elementary loops Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-22 13:35 -0400
Re: elementary loops v_borchert@despammed.com (Volker Borchert) - 2015-06-22 19:17 +0000
Re: elementary loops Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-22 16:15 -0400
Re: elementary loops Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-22 16:28 -0400
Re: elementary loops Arne Vajhøj <arne@vajhoej.dk> - 2015-06-28 20:09 -0400
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2015-06-22 13:35 -0400 |
| Subject | Re: elementary loops |
| Message-ID | <mm9gtv$3mb$1@dont-email.me> |
On 6/22/2015 12:15 PM, Stefan Ram wrote:
> public class Main
> { public static void main( final java.lang.String[] args )
> { short i = -1;
> int j = -1;
> for( int k = 0; k < 65; ++k ){ i >>>= 1; j <<= 32; }
> java.lang.System.out.println( i );
> java.lang.System.out.println( j ); }}
>
> I hope you can all predict what this prints and explain why.
It prints "Rejected by code review," and the explanation
is "Because it's badly formatted, and silly to boot."
In the actual code, are there any clues as to what the author
intended to accomplish? I'd be interested in any explanation,
even if it's largely speculative.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
[toc] | [next] | [standalone]
| From | v_borchert@despammed.com (Volker Borchert) |
|---|---|
| Date | 2015-06-22 19:17 +0000 |
| Message-ID | <mm9mvd$b36$1@Gaia.teknon.de> |
| In reply to | #31839 |
Eric Sosman wrote:
> On 6/22/2015 12:15 PM, Stefan Ram wrote:
> > public class Main
> > { public static void main( final java.lang.String[] args )
> > { short i = -1;
> > int j = -1;
> > for( int k = 0; k < 65; ++k ){ i >>>= 1; j <<= 32; }
> > java.lang.System.out.println( i );
> > java.lang.System.out.println( j ); }}
> >
> > I hope you can all predict what this prints and explain why.
>
> It prints "Rejected by code review," and the explanation
> is "Because it's badly formatted, and silly to boot."
I think it'll rather throw a DoYourHomeworkYourselfException,
which is a well known subclass of SecurityException.
> In the actual code, are there any clues as to what the author
> intended to accomplish? I'd be interested in any explanation,
> even if it's largely speculative.
It looks suspiciously like homework.
--
"I'm a doctor, not a mechanic." Dr Leonard McCoy <mccoy@ncc1701.starfleet.fed>
"I'm a mechanic, not a doctor." Volker Borchert <v_borchert@despammed.com>
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2015-06-22 16:15 -0400 |
| Message-ID | <mm9qah$b69$1@dont-email.me> |
| In reply to | #31840 |
On 6/22/2015 3:17 PM, Volker Borchert wrote:
> Eric Sosman wrote:
>> On 6/22/2015 12:15 PM, Stefan Ram wrote:
>>> public class Main
>>> { public static void main( final java.lang.String[] args )
>>> { short i = -1;
>>> int j = -1;
>>> for( int k = 0; k < 65; ++k ){ i >>>= 1; j <<= 32; }
>>> java.lang.System.out.println( i );
>>> java.lang.System.out.println( j ); }}
>>>
>>> I hope you can all predict what this prints and explain why.
>>
>> It prints "Rejected by code review," and the explanation
>> is "Because it's badly formatted, and silly to boot."
>
> I think it'll rather throw a DoYourHomeworkYourselfException,
> which is a well known subclass of SecurityException.
>
>> In the actual code, are there any clues as to what the author
>> intended to accomplish? I'd be interested in any explanation,
>> even if it's largely speculative.
>
> It looks suspiciously like homework.
That's possible, I guess, but why would Stefan give his students
such a silly problem? (Then again, I can't see why he mentioned
loops in the title: There's a loop present, but it really has nothing
to do with the issue.)
Stefan: Was this a quickie quiz for beginner-level programmers,
or did you adapt it from somebody's actual blunder? (Maybe a blunder
written by a beginner-level-and-struggling examination taker?)
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2015-06-22 16:28 -0400 |
| Message-ID | <mm9r2q$dfe$1@dont-email.me> |
| In reply to | #31841 |
On 6/22/2015 4:15 PM, Eric Sosman wrote:
> On 6/22/2015 3:17 PM, Volker Borchert wrote:
>> Eric Sosman wrote:
>>> On 6/22/2015 12:15 PM, Stefan Ram wrote:
>>>> public class Main
>>>> { public static void main( final java.lang.String[] args )
>>>> { short i = -1;
>>>> int j = -1;
>>>> for( int k = 0; k < 65; ++k ){ i >>>= 1; j <<= 32; }
>>>> java.lang.System.out.println( i );
>>>> java.lang.System.out.println( j ); }}
>>>>
>>>> I hope you can all predict what this prints and explain why.
>>>
>>> It prints "Rejected by code review," and the explanation
>>> is "Because it's badly formatted, and silly to boot."
>>
>> I think it'll rather throw a DoYourHomeworkYourselfException,
>> which is a well known subclass of SecurityException.
>>
>>> In the actual code, are there any clues as to what the author
>>> intended to accomplish? I'd be interested in any explanation,
>>> even if it's largely speculative.
>>
>> It looks suspiciously like homework.
>
> That's possible, I guess, but why would Stefan give his students
> such a silly problem? (Then again, I can't see why he mentioned
> loops in the title: There's a loop present, but it really has nothing
> to do with the issue.)
>
> Stefan: Was this a quickie quiz for beginner-level programmers,
> or did you adapt it from somebody's actual blunder? (Maybe a blunder
> written by a beginner-level-and-struggling examination taker?)
Wild guess about the "loops" part: Was the original something like
for (short i = -1; i != 0; i >>>= 1) { ... }
?
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2015-06-28 20:09 -0400 |
| Message-ID | <55908cd7$0$291$14726298@news.sunsite.dk> |
| In reply to | #31840 |
On 6/22/2015 3:17 PM, Volker Borchert wrote:
> Eric Sosman wrote:
>> On 6/22/2015 12:15 PM, Stefan Ram wrote:
>>> public class Main
>>> { public static void main( final java.lang.String[] args )
>>> { short i = -1;
>>> int j = -1;
>>> for( int k = 0; k < 65; ++k ){ i >>>= 1; j <<= 32; }
>>> java.lang.System.out.println( i );
>>> java.lang.System.out.println( j ); }}
>>>
>>> I hope you can all predict what this prints and explain why.
>>
>> It prints "Rejected by code review," and the explanation
>> is "Because it's badly formatted, and silly to boot."
>
> I think it'll rather throw a DoYourHomeworkYourselfException,
> which is a well known subclass of SecurityException.
>
>> In the actual code, are there any clues as to what the author
>> intended to accomplish? I'd be interested in any explanation,
>> even if it's largely speculative.
>
> It looks suspiciously like homework.
I believe Stefan is a teacher not a student.
Arne
PS: I completely agree about the formatting.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web