Re: Preprocessing with gcc -E
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Wed, 27 Aug 2008 23:34:59 +0100
Tim Frink <plfriko@xxxxxxxx> writes:
First of all, sorry for the double post.
I am tempted to say, stop wanting that. Even in you get something
that works, it will interact badly with build tools like make that can
compile source files in any order. What is the coding problem that
you are trying to solve this way?
I'll answer here to all the other posts: I have a prototype program
analysis tool that only accepts single files. The benchmark I wanted
to evaluate however consists of multiple compilation units. So my
idea was to "paste" all files automatically into one file via a
preprocessor. But this doesn't seem to work.
No, it won't work. In C the file boundaries are important. If you
concatenate sources the result not likely to be legal C and crucial
information will have been lost.
However, I'm still somewhat surprised because
"gcc a.c b.c" works fine. If each function is handled separately
I would expect to get some error of type "multiple definition of"
int_least8_t ... Why does this not happen?
Linking two compiled files (C calls the compilation units), each of
which contains a typedef for this type does not result in anything
being multiply defined. Essentially, a typedef is not visible outside
of the unit that contains it. If the same type name was defined twice
in the same compilation unit, or two separate compilation units
defined the same object with external linkage, you would get an error.
--
Ben.
.
- References:
- Re: Preprocessing with gcc -E
- From: Ben Bacarisse
- Re: Preprocessing with gcc -E
- From: Tim Frink
- Re: Preprocessing with gcc -E
- Prev by Date: TCP-based chat program
- Next by Date: Re: the best data structure
- Previous by thread: Re: Preprocessing with gcc -E
- Next by thread: Re: Preprocessing with gcc -E
- Index(es):
Relevant Pages
|