I would imagine it does the string concat and then disregards it. It would concat, pass the final string to the function, fail the if, return, and discard the string...
- Dan On Fri, Oct 2, 2009 at 9:31 AM, jsdf <jasons...@gmail.com> wrote: > > Hi all, > > I have been using the following conventions for my applications: > > - I define a static log(String msg) function centrally as: > public static void log(String msg) { > if (LOG) Log.v(msg); > } > > - While debugging, LOG is true. For production, LOG is false. > > - Throughout the code, I will then log with functions like: > MainApp.log("This is a logged message, variable a="+a); > > My question is, if I set LOG to false, will the compiler recognize > that the entire log function is useless and not even perform the > string concatenation? Or, will it perform the string concatenation, > but then immediately disregard the results? Obviously, I prefer the > former (fewer ops = better), but I don't know how to check for this. > > Thanks, > jsdf > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---