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.
>No, because no-one has posted questions or asked discussions. >Do you have a question or discussion topic to get the list >rolling? > > --Per Bothner >Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner I will because I'd like to have a place to ask general questions. You know the old rule of don't do anything inside a loop repeatedly that can be done once outside the loop. Say you are going to somehow manipulate a String by looking at each character. The code is cleaner doing the following: for(int k=0;k<thestring.length();++k) { char c = thestring.charAt(k); // do something to it } 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. Or does the optimizer take care of it? What do you all think? What do you do?