[Insight-developers] pragma once
Stephen R. Aylward
Stephen.Aylward at Kitware.com
Thu May 25 13:07:14 EDT 2006
We have a situation where multiple libraries are being distributed in
both ITK and VTK. Long story short - we can build work-arounds that are
backward compatible using cmake directives, except I haven't found a
workaround for the #ifdef wrapping of headers (given that the headers in
two different places use the same #define variable, and may be directly
included by the user). So, I'm considering the "#pragma once" directive.
Thanks!
Stephen
Kent Williams wrote:
> The standard behavior of C/C++ compilers is to ignore #pragmas they
> don't implement.
>
> I would think that given that we use #ifdef file guards everywhere, it
> would be safe to use #pragma once. If it isn't honored, everything will
> still work, with the possible overhead of including something already
> included.
>
> Is there a situation where using #pragma once is anything more than a
> hint to the compiler to short-circuit parsing an include file?
>
> Stephen R. Aylward wrote:
>
>> Hi,
>>
>> Has anyone already investigated whether or not all of the supported
>> ITK compilers honor the "#pragma once" directive?
>>
>> Thanks,
>> Stephen
>>
>
>
--
=============================================================
Stephen R. Aylward, Ph.D.
Chief Medical Scientist
Kitware, Inc.
http://www.kitware.com
More information about the Insight-developers
mailing list