Header guards - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Programming Languages & Scripting (/forum-8.html)
+--- Thread: Header guards (/thread-3347.html)
Header guards - Duane - Apr 17, 2007 04:42 PM
Well, it would seem that "#pragma once" is the better choice, especially because of speed for compiling and the reduced chance for error, but gcc has listed it as "obsolete." Are the traditional "#ifndef" header guards better, or is the #pragma option the good route?
Header guards - bronxbomber92 - Apr 17, 2007 05:01 PM
I believe the #pragma once technique varies from compiler to compiler, so you're not garunteed it will work everywhere.
Header guards - OneSadCookie - Apr 17, 2007 05:42 PM
#pragma once is supported in every C/C++ compiler I've ever used (GCC, MSVC, XLC, ICC, CW).
GCC were about to phase out #pragma once and #import because they were broken, but Apple fixed them, and I believe they're unlikely to go away now.
Header guards - Duane - Apr 17, 2007 06:30 PM
The god spoke, and the peasants wept with joy, the kings proclaimed festivals accross their kingdoms, and "#pragma once" was used throughout the land.
(Damn I'm tired).
Header guards - wyrmmage - Apr 24, 2007 10:59 AM
Nayr Wrote:The god spoke, and the peasants wept with joy, the kings proclaimed festivals accross their kingdoms, and "#pragma once" was used throughout the land.
I always used #infdef myself, but just because I learned about them first