-
inclusion guards
When writing header files I've always used the folowing format
Code:
#ifndef HEADER_H
#define HEADER_H
.
.
//code here
.
.
#endif
Now I've bought a C++ .Net book and it uses an alternative approach:
#pragma once
Is this better or worse or does it not make any difference which one I use?
TIA
-
#pragma once
is NOT defined in C++ and therefore is not guaranteed to be portable from compiler to compiler. It's in the .NET book because they are most-likely assuming you are using MSVC++ .NET (a compiler which defines the command to only open the file it is in once).