> I'm not sure I fully understand what is going on here, but I believe
> it is related to implicit conversions and temp objects created when
> returning the _color object.

> The change remove the need for some of the temporary objects that need
> to be created and copied around when rgba.color() is used by GetColor,
> and I believe it is good coding style to avoid forcing the compiler to
> create more object that necessary.
> 
> Is this the correct fix?  Anyone understand why it is needed?

It doesn't sound like it; passing by value is generally less
accident-prone than using references, and in this case pretty friendly
towards compiler optimizations. As a rule we should try to pass simple
data structures by value; an rgba object is half the size of a pointer
on some platforms and trivial to copy.

The aliasing rule concerns the way objects may be accessed through
pointers of a different type, which in some circumstances can lead to
the original variable being optimized out. It seems to me that the
problem is more internal to boost::variant.

I don't think it's a good idea to change code to fix a warning that we
don't properly understand, particularly as the change may make the code
less useful without necessarily fixing anything.

bwy

-- 
--
The current release of Gnash is 0.8.8
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de
C++ and Open-Source Flash blog - http://www.benjaminwolsey.de/bwysblog

xmpp:[email protected]
http://identi.ca/bwy

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to