begin quoting Gabriel Sechan as of Wed, Jun 07, 2006 at 08:48:13PM -0500: [snip] > He's wrong about the results of the bug- he says in C it overflows by > going to an invalid index via underflow. In C, you'd use an unsigned int > (does Java have this?)
No, Java does not have an unsigned int. But then, there's no problem with using a negative index into an array -- you just get an exception. When someone finally *does* demonstrate this, it'll be a quick identification of what went wrong and where. I love Java stack traces. (Fought with a C++ app today that had a permission problem when reading a file, so I got a cryptic "Program failed to initialize" error... Gah!) > thus wouldn't go to a negative index (although it is > still a bug, it won't crash the app. It may infinite loop). Heh. Been there, done that, back in one of my first C programs, IIRC. > IF a variable > is supposed to be a loop index, it should always be unsigned in any > language. Erm, no. Even for array indexes, there are languages where that's allowed. There's a disconnect between the hardware and the software and our minds. WE don't put an upper limit on numbers. Hardware does. Software is in between. . . -- _ |\_ \| -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
