Cpp Coding Standards/HEADERS/IncGuards

From Apache OpenOffice Wiki
< Cpp Coding Standards‎ | HEADERS
Revision as of 17:12, 14 December 2009 by B michaelsen (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Internal Include Guards (IncGuards)

Internal include guards are good but don't use the external ones. They add a lot of noise for a non-existent benefit. Also, they add unwanted, and not always noted, dependencies, if for any reason the guarding define changes.

// Foo.hxx

// Yes, use internal include guards
#ifndef INCLUDED_FOO_HXX
#define INCLUDED_FOO_HXX

// No include guards here
#include "Superclass.hxx" 
...

#endif
// Bar.cxx

// No include guards here
#include "Bar.hxx"
#include "Foo.hxx"
#include "Baz.hxx"
Personal tools