Mail Archives: djgpp/1999/10/02/02:43:44
On Sat, 02 Oct 1999 03:29:07 GMT, wemccaug AT prairienet DOT org (Wendy E.
McCaughrin) wrote:
> This is a good point -- in fact, I was compiling with -O (but it
> would be nice to be warned of such optimizations). BTW, if -O is
> assuming that default (bit-wise) copy is always more efficient
> than invoking the copy-ctor, doesn't that require some knowledge
> of what the copy-ctor does?
Using -O doesn't make gcc assume that the bitwise copy is more
efficient than invoking the copy-ctor. gcc will *never* do a bitwise
copy if a copy-ctor is defined. The point I am trying to make is, in
the example program you gave, no copy was performed (bitwise, or via
the ctor).
The temporary object is simply constructed (using the char *
conversion ctor) directly on the stack, right where it needs to be in
order for it to be passed to the function.
I hope this is more clear.
Davin.
__________________________________________________________
*** davmac - sharkin'!! davmac AT iname DOT com ***
my programming page: http://yoyo.cc.monash.edu.au/~davmac/
- Raw text -