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

Andrew Koenig ark at alice.UucP
Tue Jan 28 05:16:35 AEST 1986


> To explain what I mean...
> definition by example:
> 
>     #PATH ==> /usr/fred/hello.c
>     #FILE ==> hello.c
>     #FUNCTION ==> main
> 
>     (N.B.: no quotation marks.)
> 

Most versions of the C preprocessor have (undocumented) pre-defined
macros called __FILE__ and __LINE__ that do close to what you want.
See /usr/include/assert.h for an example of usage.



More information about the Comp.lang.c mailing list