pragma once
-
If I put pragma once in all my .h files that is sufficient to prevent any include multile definition problems right? Is this the same thing as doing #ifndef #define #endif that we see in the MFC .h generated files? If so , pragma once is much easier, so why isnt that used by t he Class wizard instead of the ifndef stuff? Appreciate your help, ns
-
If I put pragma once in all my .h files that is sufficient to prevent any include multile definition problems right? Is this the same thing as doing #ifndef #define #endif that we see in the MFC .h generated files? If so , pragma once is much easier, so why isnt that used by t he Class wizard instead of the ifndef stuff? Appreciate your help, ns
In VC7, generated headers have only the #pragma once line. My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
If I put pragma once in all my .h files that is sufficient to prevent any include multile definition problems right? Is this the same thing as doing #ifndef #define #endif that we see in the MFC .h generated files? If so , pragma once is much easier, so why isnt that used by t he Class wizard instead of the ifndef stuff? Appreciate your help, ns
As you say, both alternatives are equivalent.
#pragma once
, on the other hand, is not standard C or C++, so in general I prefer the#ifndef
guard. As MS guys usually don't bother about standard compliance, I guess they don't use#pragma once
only for historical reasons. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
As you say, both alternatives are equivalent.
#pragma once
, on the other hand, is not standard C or C++, so in general I prefer the#ifndef
guard. As MS guys usually don't bother about standard compliance, I guess they don't use#pragma once
only for historical reasons. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo