Review Request: Add #pragma once to headers generated by "New Class" wizard

Andreas Pakulat apaku at gmx.de
Fri Jan 21 21:20:21 UTC 2011



> On Jan. 21, 2011, 9:02 p.m., Aleix Pol Gonzalez wrote:
> > #pragma once is not a standard and it's not really an improvement in GCC (safe guards are already optimized).
> > Also it's not in the C++ standard.
> > 
> > I don't think this should go in.
> 
> Valentyn Pavliuchenko wrote:
>     pragma once is already implemented by all popular compilers. If we're not writing a portable code then it's even better than include guards.
>     About optimizations - yes, GCC already does this, but GCC is not the only existing compiler, so pragma once will be good for really portable projects.
>     I think there's nothing bad in having pragma once in addition to include guards.

Except that include-guards will work on any compiler that has a proper C pre-processor. For #pragma the pre-processor needs to support it. What about ancient compilers used for some embedded platforms? I'm regularly seeing customers at work that use stuff like gcc 2.77 or exotic compilers like AIX or old Solaris systems. 

And really 2 ways to avoid double-inclusion are one too many.


- Andreas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/100432/#review1016
-----------------------------------------------------------


On Jan. 21, 2011, 8:28 p.m., Valentyn Pavliuchenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100432/
> -----------------------------------------------------------
> 
> (Updated Jan. 21, 2011, 8:28 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Summary
> -------
> 
> Add #pragma once to headers generated by "New Class" wizard in addition to include guards.
> 
> 
> This addresses bug 263913.
>     http://bugs.kde.org/show_bug.cgi?id=263913
> 
> 
> Diffs
> -----
> 
>   languages/cpp/codegen/cppnewclass.cpp 8bc82af 
> 
> Diff: http://git.reviewboard.kde.org/r/100432/diff
> 
> 
> Testing
> -------
> 
> Manual testing done.
> 
> 
> Thanks,
> 
> Valentyn
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110121/969366ad/attachment.html>


More information about the KDevelop-devel mailing list