I\'ve read that there is some compiler optimization when using #pragma once which can result in faster compilation. I recognize that is non-standard, and thus
I don't know about any performance benefits but it certainly works. I use it in all my C++ projects (granted I am using the MS compiler). I find it to be more effective than using
#ifndef HEADERNAME_H
#define HEADERNAME_H
...
#endif
It does the same job and doesn't populate the preprocessor with additional macros.
GCC supports #pragma once officially as of version 3.4.