Status of import and pragma once?

AWLaFramboise@aol.com AWLaFramboise@aol.com
Mon Jun 2 08:49:00 GMT 2003


Hi,

On 4 Mar 2003 Geoff Keating said he was working on a
"cppfiles rewrite."  What is the status on this?

I missed these issues when they were being discussed,
and I probably should have chimed in then, but, if it isn't
too late, I'd like to add a small point:

I personally do not care about #import, and I don't use
Objective C, but #pragma once operating correctly in C
is important to me.  #pragma once is extremely common
in win32 code, in particular code written by Microsoft.
Current Microsoft sources for a variety of important
packages (such as the Platform SDK) require proper functioning
of #pragma once.  In addition, the current release of MIDL
(Microsoft IDL) generates code that uses #pragma once.

(Aside: #pragma once is probably used in this generated output
because it is possibly superior to header guards, if
pragma once is well-defined.  Generated code may not be able
to come up with a unique header guard macro using
the filename (since there may be similar yet unrelated
filenames, and the generator may not know how to qualify it),
and generating pseudorandom header guards macros would yield
(trivially) different output every time the generator was
run, and perhaps this nondeterminism is not good.)

While pragma once is certainly an extension, it seems like
a good extension to support due to its existing usage.
I note other extension pragmas are documented in the GCC
manual for compatibility with system compilers.

While I understand there are workarounds, it would be rather
painful for me to have to run all of these files (that I didnt
write, and that may be auto-generated as part of the build
process) through a converter to use them with GCC.  So,
for whatever it is worth, I'd rate a well-defined #pragma
once feature as "very important," and I would be "strongly
opposed to" removing this feature from GCC 3.4.

Aaron



More information about the Gcc mailing list