This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/29245] want way to #include but still able to finish compiling

------- Comment #11 from acahalan at gmail dot com  2006-10-01 07:50 -------
(In reply to comment #10)
> > I'm more familiar with the POSIX/UNIX standardization than the C/C++
> > standardization. Perhaps they have very different rules, but what
> > I've seen with the one group is that the committee strongly prefers
> > that there be an existing implementation.
> But after the proposal has been written formally.

I have been assuming you have representatives on the committees.
Hopefully it is no big deal to submit something.

BTW, though most useful if standardized, it is still useful for
semi-portable code when not standardized. Sometimes people write
gcc-specific code but wish to support more than one OS or more
than one OS version.

Something simple, as shown above, is probably best.
Just in case something really powerful would be
more appealing though...

Fourth idea:

#  include <foo.h>
#  include <bar.h>
#  if MY_HEADERS != _Notincluded
#    throw MY_HEADERS
#  endif
#  ifndef FOO
#    define FOO 0
#  endif

Fifth idea:

#func get_header_file(a)
##include a
#if eval(get_header_file(<foo.h>))

Sixth idea (hey it works for web pages):

#script safeinc(hf,def) { \
file=open(hf); \
if(file) emit(read(file)); \
else emit("#define " + def); \
#eval safeinc(<foo.h>,NO_FOO_HEADER)

(with that one maybe the script could manipulate
the content a bit, editing the text before parsing
or editing the parse tree representation afterward)

Seventh idea (hey, it works for the Makefile):

#shell "cat " _Realname(<foo.h>) " || true"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]