How about a predefined #FILE, #PATH and #FUNCTION for C?

Guy Harris guy at sun.uucp
Tue Jan 28 17:41:58 AEST 1986


> I cannot claim to speak about other versions of unix, but in Berkeley
> 4.2 and 4.3, there are two macros automatically defined for you by the
> c preprocessor: __FILE__ and __LINE__. ...
>
> Could someone on a non-4.2/4.3 BSD machine tell us if this facility is
> part of other preprocessors as well?  Thanks.

This facility was added to the C preprocessor by John Reiser at Bell Labs;
it first appeared outside the Labs in V7.  It is, therefore, in V7 and all
post-V7 UNIX systems except those where the supplier decided to "improve" it
by supplying a C compiler which doesn't support it - let's hope there aren't
any such systems.  It's even documented in the System V "cpp" manual page,
along with the "defined()" operator.  I believe that both __FILE__ and
__LINE__, as well as "defined()", are in the ANSI C draft standard.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy%gorodish at sun.arpa	(yes, really)



More information about the Comp.lang.c mailing list