Subject: Re: gcc Q - a bit off topic
To: Jeremy Cooper <jeremy@broder.com>
From: Peter Seebach <seebs@herd.plethora.net>
List: current-users
Date: 10/21/1997 23:59:21
In message <Pine.BSI.3.96.971021200741.3450M-100000@pillbox.broder.com>, Jeremy
 Cooper writes:
>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
	puts(__\
	LINE__);

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.  :)

-s