Roland Mainz wrote: > James Carlson wrote: > >> Garrett D'Amore writes: >> >>> Piotr Jasiukajtis / estibi wrote: >>> > [snip] > >> - Don't use 'const' with non-pointer arguments. It's silly there. >> > > Why ? It gives the compiler valueable hints how the argument is/should > be used. AFAIK this was one of the early things which even the old C > compilers (long before ANSI C) tried to optimize when they found a > |const| variable. The old SAS/C compiler documentation even recommends > it... >
Modern compilers shouldn't need the declaration to optimize it -- they can tell if the value ever changes within the function being compiled. And since variables are passed by value, the const declaration means nothing to the caller as well. So while these types of hints may be useful for ancient compilers, the state of the art has long since moved past that point. -- Garrett > ---- > > Bye, > Roland > > _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code