Mail Archives: djgpp/1999/02/14/06:11:19
On Fri, 12 Feb 1999, Paul Derbyshire wrote:
> If so, this leads me to ask: under what circumstances will the compiler be
> smart enough to detect that an inline function passed an argument of a
> builtin type doesn't modify it and avoid making an unnecessary copy?
From the GCC docs, it seems that declaring the function with
__attribute__((const)) will tell the compiler what you want, so you
won't need to rely on the optimizer being smart enough. I didn't
actually try to see what that does in the special case you are
describing. It's probably easy enough to use -S and look at the
assembly code it generates.
- Raw text -