cpp: Alternatives to Wrapper #ifndef

1 
1 2.5 Alternatives to Wrapper #ifndef
1 ===================================
1 
1 CPP supports two more ways of indicating that a header file should be
1 read only once.  Neither one is as portable as a wrapper '#ifndef' and
1 we recommend you do not use them in new programs, with the caveat that
1 '#import' is standard practice in Objective-C.
1 
1    CPP supports a variant of '#include' called '#import' which includes
1 a file, but does so at most once.  If you use '#import' instead of
1 '#include', then you don't need the conditionals inside the header file
1 to prevent multiple inclusion of the contents.  '#import' is standard in
1 Objective-C, but is considered a deprecated extension in C and C++.
1 
1    '#import' is not a well designed feature.  It requires the users of a
1 header file to know that it should only be included once.  It is much
1 better for the header file's implementor to write the file so that users
1 don't need to know this.  Using a wrapper '#ifndef' accomplishes this
1 goal.
1 
1    In the present implementation, a single use of '#import' will prevent
1 the file from ever being read again, by either '#import' or '#include'.
1 You should not rely on this; do not use both '#import' and '#include' to
1 refer to the same header file.
1 
1    Another way to prevent a header file from being included more than
1 once is with the '#pragma once' directive.  If '#pragma once' is seen
1 when scanning a header file, that file will never be read again, no
1 matter what.
1 
1    '#pragma once' does not have the problems that '#import' does, but it
1 is not recognized by all preprocessors, so you cannot rely on it in a
1 portable program.
1