<div dir="ltr"><div>I certainly have been bitten much more times by include guards that were the same in different files (especially in old libraries where guards look like #ifdef QUEUE_H because of course there is a single queue.h file in the whole world, or because someone just copy-pasted the content of a file to another and forgot changing include guards -- I plead guilty!) than whatever hypothetic bug in pragma once GCC's implementation may have. <br><br></div>Are there people here who had, just once, a bug due to #pragma once ? I never met any. Across network drives, with precompiled headers, unity builds, with MSVC, Clang, GCC, ccache, distcc and Icecream...<br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><div><font color="#783f04"><br></font></div><div><font size="2" color="#134f5c" face="arial, helvetica, sans-serif">-------</font></div><font size="2" color="#134f5c" face="arial, helvetica, sans-serif">Jean-Michaël Celerier</font><div><font size="2" color="#134f5c" face="arial, helvetica, sans-serif"><a href="http://www.jcelerier.name" target="_blank">http://www.jcelerier.name</a></font></div></div></div></div>
<br><div class="gmail_quote">On Wed, Jan 24, 2018 at 11:34 AM, Mitch Curtis <span dir="ltr"><<a href="mailto:mitch.curtis@qt.io" target="_blank">mitch.curtis@qt.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> -----Original Message-----<br>
> From: Ville Voutilainen [mailto:<a href="mailto:ville.voutilainen@gmail.com">ville.voutilainen@<wbr>gmail.com</a>]<br>
> Sent: Wednesday, 24 January 2018 11:25 AM<br>
> To: Alexander Nassian <<a href="mailto:nassian@bitshift-dynamics.com">nassian@bitshift-dynamics.com</a><wbr>><br>
> Cc: Mitch Curtis <<a href="mailto:mitch.curtis@qt.io">mitch.curtis@qt.io</a>>; <a href="mailto:development@qt-project.org">development@qt-project.org</a><br>
> Subject: Re: [Development] #pragma once<br>
><br>
> On 24 January 2018 at 12:22, Alexander Nassian <nassian@bitshift-<br>
> <a href="http://dynamics.com" rel="noreferrer" target="_blank">dynamics.com</a>> wrote:<br>
> > Maybe because it’s not part of the C++ standard?<br>
><br>
> #pragma once is not a replacement for include guards.<br>
<br>
</span>Why not?<br>
<span class=""><br>
> It's not part of the C++ standard because it doesn't always work<br>
<br>
</span>In which ways? My quick search gave me these:<br>
<br>
<a href="https://stackoverflow.com/a/1946730/904422" rel="noreferrer" target="_blank">https://stackoverflow.com/a/<wbr>1946730/904422</a><br>
<a href="https://en.wikipedia.org/wiki/Pragma_once#Caveats" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/<wbr>Pragma_once#Caveats</a><br>
<br>
There's also this answer that highly recommends against it, but seems quite contended in the comments:<br>
<br>
<a href="https://stackoverflow.com/a/34884735/904422" rel="noreferrer" target="_blank">https://stackoverflow.com/a/<wbr>34884735/904422</a><br>
<span class=""><br>
> and modules are a superior solution anyway.<br>
<br>
</span>How so?<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Development mailing list<br>
<a href="mailto:Development@qt-project.org">Development@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/development" rel="noreferrer" target="_blank">http://lists.qt-project.org/<wbr>mailman/listinfo/development</a><br>
</div></div></blockquote></div><br></div></div>