Cpp Coding Standards/HEADERS/IncGuards

From Apache OpenOffice Wiki
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

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

// Bar.cxx

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