Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31852
| From | Brixomatic <brixomatic@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: elementary loops |
| Date | 2015-06-25 20:20 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <MPG.2ff664b393c1c2c69896a3@news.aioe.org> (permalink) |
| References | <loops-20150622181350@ram.dialup.fu-berlin.de> |
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]
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
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
csiph-web