Boost logo

Proto :

Subject: Re: [proto] Default constructor of proto::extends
From: Eric Niebler (eric_at_[hidden])
Date: 2011-02-06 21:14:48


On 2/7/2011 6:01 AM, Antoine de Maricourt wrote:
> Hi Eric,
>
> is there any reason why the default ctor of proto::extends uses the
> following form:
>
> extends()
> : proto_expr_()
> {}
>
> instead of simply
>
> extends() {}
>
> I use proto::extends over expressions that hold x86 SIMD registers (like
> proto::terminal<__m128i>), and the current version of proto::extends
> default ctor yields to a __m128i() call, which fills the register with
> zeros, while I wanted to keep it uninitialized.
>
> Apparently the compiler (g++, 4.6 and previous versions as well) is
> enable to detect this is unneeded, as the register is in fact
> initialized a few instructions later, and the only way I was able to get
> rid of this was to remove the explicit call to proto_expr_ ctor in the
> extends ctor.

You could use BOOST_PROTO_EXTENDS instead of proto::extends. I'm a
little uncomfortable with a base class that leaves members in an
undefined state, but I'm willing to consider it. Feel free to file a
bug. Thanks.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com