Subject: Re: gcc Q - a bit off topic
To: Jeremy Cooper <email@example.com>
From: Peter Seebach <firstname.lastname@example.org>
Date: 10/21/1997 23:59:21
In message <Pine.BSI.3.96.971021200741.3450Memail@example.com>, Jeremy
>ANSI C defines two pre-processor variables which you should find helpful.
>The first is "__LINE__", which is expanded into the current line number in
>the file. The second is "__FILE__" which expands into the current
>filename in a quoted string. Unfortunately, the behavior of __LINE__ was
>defined as ``implementation specific'' (i.e. non-standard), but I believe
>GCC does what you expect.
Don't worry, we don't know of anyone doing anything *weird*.
The "implementation defined" part is,
#line foo.c 1
is this going to give 2 or 3?
Well, apparently, the resolution is that we don't *care*.
In practice, __LINE__ is a number good enough to jump to that line
in a file.
Also see __DATE__ and __TIME__. If you have a C9X implementation,
within any function you have an identifier __func__ that does the
obvious thing; I think gcc does this too. :)