Re: #pragma once in ISO standard yet?
Andre Kaufmann wrote:
:: Sean Hunt wrote:
::: [...]
::: No. #pragma once has not made it into either standard.
::: Furthermore, it's not the preferred way to do things. It's better
::: to do use #ifndef guards:
:::
::: #ifndef SOME_HEADER_EXCLUSIVE_IDENTIFIER
::: #define SOME_HEADER_EXCLUSIVE_IDENTIFIER
:::
::: .
:::
::: #endif
::
:: Since I already got hit multiple times by weird errors caused by
:: the same include guards in 2 or more header files, I tend rather
:: to hate include guards.
Yes, it is a problem, but fixable for the programmer.
::
:: Please could you shed some light on it, why include guards should
:: be that better than #pragma once or as a compiler option to
:: generally include header files only once ?
What if you have files mounted from different file systems. Is it the
compiler's responsibility to resolve all the files? How could it?
And if it doesn't work, how are you as a programmer going to fix that?
As a somewhat nasty example, I have a PC at work, which I cannot
configure myself, with
local hard disk
several (non-unique) mounts to Windows servers (group and
departmental)
several SAN mounts
access to a ClearCase mount on a UNIX server
one drive letter mapping to files on a zOS mainframe
How should the C++ standard specify #pragma once, so that it always
works? Or should it be unportable?
Bo Persson
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]