This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.
> This is how I have been doing things for a couple years now, but I always > wonder what kind of performance hit I am taking by not moving the > "char c" declaration outside the loop and breaking the age old rule. Huh? Declararions have no run-time cost on any Java implementation I know. In your example there to only thing you might want to move outside the loop is not the declaration, but the loop test: k<thestring.length() You might want to move: int len = thestring.length(); outside the loop, and use k<len as the termiation test. Now, it should not be difficult to have the compiler "know" that thestring.length() is constant if the string is the same object, in which case the compiler can do the optimization for you. (However, at this point, it does not.) --Per Bothner Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner