For a file name a.h... I've always used
#ifndef A_H
#define A_H
#endif
but now I see in tutorials
#ifndef __A_H_INCLUDED__
#define __A_H_INCLUDED__
#endif
and also
#ifndef _A_H_INCLUDED
#define _A_H_INCLUDED
#endif
So I was wondering what's going on... Has this changed in never versions of C++ or is this compiler dependent?
I use MinGw (gnu gcc g++) and msvc...
Edit:
In case there is confusion as to why this is asked, I believe that this is quite confusing to novices. For example, for a file named a.h we don't say
#ifndef a.h
#define a.h
or even
#ifndef A_H
#define A_H a.h
that would make sense to me.
instead we say A_H... or one of the variants above. Therefore, I would think not just any syntax is ok. I always used to think that it has to be the file name in caps and that the period has to be replaced with an _. This is how I saw it being taught for years. No I see words like _INCLUDED ... which are obviously not part of the a.h file name in any way... this is confusing... how does the compiler reconcile that A_H_INCLUDED refers to a.h? I don't see why this is down voted I think it's quite confusing.
Also, one person has stated that some of these variants are not standards compliant, therefore I think it is a valid question and should not be down voted.
Or is it the case that #define A_H dumps all the code from the header file into the A_H macro? But I thought that define ends at new line character... in which case we define A_H with no value. In that case A_H is just a name with no value and the question remains how does the compiler know you're talking about file a.h when you use a funky empty marco variable like A_H_DINGDONG ?