2

Occasionally I observe such header guards:

 #ifndef FOO
 #define FOO 1
 ...
 #endif // FOO

But I learned it this way:

 #ifndef FOO
 #define FOO
 ...
 #endif // FOO

Is the define to 1 an old relict to some compiler?, does it do any harm nowadays? What is the way to do it now?

pnuts
  • 58,317
  • 11
  • 87
  • 139
math
  • 8,514
  • 10
  • 53
  • 61
  • `#define FOO 1` just permit you to use FOO as 1, it won't do any harm on you compiler. Use it as an include guard is just an old trick to avoid multiple declaration. – Bastien May 14 '13 at 12:07

0 Answers0