<div dir="ltr">This seems like a better discussion to have on cfe-dev than on llvm-dev FWIW.<div><br></div><div>(I also happen to agree with Eli, but that's somewhat irrelevant.)</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 15, 2019 at 7:16 PM Eli Friedman via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/15/2019 6:09 PM, Alexandre Isoard via llvm-dev wrote:<br>
> Hello,<br>
><br>
> For performance reasons, I would like to provide a way to skip <br>
> construction/destruction of objects that are stack allocated. <br>
> Typically, C-style arrays of std::complex create an initialization <br>
> loops that is almost always unnecessary.<br>
><br>
> I am thinking of providing an __attribute__((uninitialized)) that can <br>
> be applied to an object declaration:<br>
><br>
> {<br>
> std::complex<float> foo[64][64] __attribute__((uninitialized));<br>
> // does not need to generate a zeroinitializer loop here<br>
> somefunction(foo);<br>
> // does not need to generate a destructor loop here <br>
> (std::complex<float> don't have one anyway)<br>
> }<br>
><br>
> Formally speaking, we won't call constructors/destructors on those <br>
> objects anymore. We would provide "uninitialized" memory in the same <br>
> meaning as malloc/free.<br>
><br>
> Do you see this as a good idea? Do we already have a better way of <br>
> achieving this?<br>
<br>
The standard way to allocate uninitialized storage in C++ is <br>
std::aligned_storage. The proposed extension doesn't really seem like <br>
an improvement over that.<br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>