$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Henrik Ravn (web_at_[hidden])
Date: 2002-08-27 17:23:39
> Often, when one wants to make sure a header is included only 
> once, s/he uses
> the paradigm:
> 
> #ifndef HEADER_NAME_H__
> #define HEADER_NAME_H__
> 
> // code here...
> 
> #endif // HEADER_NAME_H__ -- this comment is to make it clear 
> what the endif
> is for
> 
> 
> It is better to remove the duality of the comment at the end, 
> by switching
> to this paradigm:
> 
> 
> #ifndef HEADER_NAME_H__
> 
> // code here...
> 
> #define HEADER_NAME_H__
> #endif
I would argue that the easiest idiom to use is this:
#ifndef HEADER_NAME
#define HEADER_NAME
// code here ...
#endif // include guard 
in this way you don't have to update the header file both at the top and
the bottom in the infrequent event of a rename.
> When maintiaining a file -- renaming it -- with the comment, 
> one has to make
> sure the comment is also updated. This alternative removes the comment
> because it is superfluous, and the compiler will help you if 
> you forget to
> change the #define at the end.
How will the compiler help me if I forget to change the #define at the
end? I mean, as opposed to having it at the top?
be well
-h-