Ambitious contributor
24Jan2008,11:32   #11
oogabooga's Avatar
Macro guards are the preferred method for ensuring single inclusion.
It is more portable and does not have the problems of #pragma once
(cannot know that the same file is included under two different names
as can occur with links on unix, etc.).
gcc considers #pragma once to be deprecated.
These are macro (or include) guards:
Code:
// header.h
#ifndef HEADER_H
#define HEADER_H
...
#endif
TechCake
24Jan2008,14:22   #12
asadullah.ansari's Avatar
In pragma once same code is written as you have written.
Light Poster
24Jan2008,16:58   #13
princemaozh's Avatar
Salem, thank you very much for the explanation.

Shabbir and others, also thanks for your comments.