#ifndef syntax for include guards in C++
Posted
by
PhADDinTraining
on Stack Overflow
See other posts from Stack Overflow
or by PhADDinTraining
Published on 2012-04-09T17:20:47Z
Indexed on
2012/04/09
17:28 UTC
Read the original article
Hit count: 219
I'm currently studying for a CS course's final exam and I've run into a minor (maybe major?) issue regarding the syntax of C++ #ifndef.
I've looked at the syntax for #infndef when using it as an #include guard, and most on the web seem to say:
#ifndef HEADER_H
#include "header.h"
...
#endif
But my class's tutorial slides show examples as:
#ifndef __HEADER_H__
#include "header.h"
...
#endif
I was wondering what (if any) the difference was between the two. The exam will most likely ask me to write an #include guard, and I know conventional wisdom is to just go with what the prof / tutor says, but if there's a difference during compilation I'd like to know.
Thanks all!
© Stack Overflow or respective owner