<div dir="ltr">Hello,<div><br></div><div>For performance reasons, I would like to provide a way to skip construction/destruction of objects that are stack allocated. Typically, C-style arrays of std::complex create an initialization loops that is almost always unnecessary.</div><div><br></div><div>I am thinking of providing an __attribute__((uninitialized)) that can be applied to an object declaration:</div><div><br></div><div>{</div><div>    std::complex<float> foo[64][64] __attribute__((uninitialized));</div><div>    // does not need to generate a zeroinitializer loop here</div><div>    somefunction(foo);</div><div>    // does not need to generate a destructor loop here (std::complex<float> don't have one anyway)</div><div>}</div><div><br></div><div>Formally speaking, we won't call constructors/destructors on those objects anymore. We would provide "uninitialized" memory in the same meaning as malloc/free.</div><div><br></div><div>Do you see this as a good idea? Do we already have a better way of achieving this?</div><div><br></div><div>I'm worried about the fact that for non-POD types it is not safe to ignore that attribute, which probably means using an attribute is not a good fit...</div><div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div></div></div>