Boost logo

Boost Users :

Subject: Re: [Boost-users] Bizarre problem with range/adaptor/transformed.hpp
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2011-08-02 10:25:31

On 8/1/2011 3:29 AM, Mathias Gaunard wrote:

> It might be a good idea to make those PODs to avoid dynamic initialization.

They are empty, so are POD. The syntax used appears to force the compiler to use dynamic
initialization anyway; in an optimized build I suppose it might be removed completely.
But in debug build I noticed that it is allocated in the section with dynamically
initialized objects, takes 1 byte (plus padding), and the constructor for the variable
fills the padding with CC's and the single dummy byte with 0.

It would indeed be nicer if the required dummy byte was initialized at compile time only,
bringing the zero in with the program image, and didn't need to call a (empty) function to

Is there some reason why the author didn't use

        const forwarderXYZ<transform_holderXYZ> transformedXYZ;

with default initialization?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at