mahdert
8/5/2011 1:40:00 AM
On Jul 31, 8:30 am, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
> Mateusz_madi <madi.cz...@gmail.com> writes:
> > Hi all, I have question about preprocessor. I fi have a program called
> > binary_s.c and i put it only on preprocessor like:
> > cc -E binary_s.c and i get strange output at the beginning of file
> > like:
>
> > # 1 "binary_s.c"
> > # 1 "<built-in>"
> > # 1 "<command-line>"
> > # 1 "binary_s.c"
>
> > What are those if I didn't included any libaries ?
>
> These are internal to the implementation (gcc, from the look of it).
> The implementation can make the result of running only the preprocessor
> almost anything it likes since the C standard does not mandate anything
> but the overall effect of translating a program. However, most
> implementations try to make the output of the preprocessor valid C. The
> standard permits almost anything after a # and most implementations take
> advantage of this to do keep track of information they might need later
> on in the translation process.
>
> In this case, the lines record the position in the stream of tokens that
> is being processed (mainly for error reporting). For example, if you
> had -include x.h on the command line, any tokens resulting from it would
> have appeared between the 3rd and 4th lines of you example (together
> with a further '#' line to note the new file being processed). Any
> errors in x.h can then be noted as coming from "x.h included from
> command-line" or some such text.
>
> --
> Ben.
test post