Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31852 > unrolled thread

Re: elementary loops

Started byBrixomatic <brixomatic@yahoo.com>
First post2015-06-25 20:20 +0200
Last post2015-06-25 14:57 -0400
Articles 2 — 2 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.


Contents

  Re: elementary loops Brixomatic <brixomatic@yahoo.com> - 2015-06-25 20:20 +0200
    Re: elementary loops Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-25 14:57 -0400

#31852 — Re: elementary loops

FromBrixomatic <brixomatic@yahoo.com>
Date2015-06-25 20:20 +0200
SubjectRe: elementary loops
Message-ID<MPG.2ff664b393c1c2c69896a3@news.aioe.org>
In article <loops-20150622181350@ram.dialup.fu-berlin.de>, Stefan Ram 
(ram@zedat.fu-berlin.de) says...
> 
> 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.

Ah, I recognize this.. 
The j should stay -1.
It's a blunder taken over from C, where retard had a bad moment and 
stated that shifting a 32 bit number by 32 bits makes no sense, so he'd 
make it a NOP, instead of doing what a sane person would: give one 32 
bit shift the same result as 32 one bit shifts.

Kind regards,
-Wanja-





-- 
..Alesi's problem was that the back of the car was jumping up and down 
dangerously - and I can assure you from having been teammate to 
Jean Alesi and knowing what kind of cars that he can pull up with, 
when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer]

[toc] | [next] | [standalone]


#31853

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2015-06-25 14:57 -0400
Message-ID<mmhit6$jkj$1@dont-email.me>
In reply to#31852
On 6/25/2015 2:20 PM, Brixomatic wrote:
> In article <loops-20150622181350@ram.dialup.fu-berlin.de>, Stefan Ram
> (ram@zedat.fu-berlin.de) says...
>>
>> 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.
>
> Ah, I recognize this..
> The j should stay -1.

     Halfway there.  See anything else?

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web