Re: Short form of __FILE__

"Lukas Ruf" <ruf@xxxxxxxxx> wrote in message
Dear all,

for debugging purposes, I like the pre-compiler macros

__FILE__, __FUNCTION__, __LINE__

I have been wondering if there is a short form of __FILE__ that
provides only the filename without path.

I am using gcc as available in Debian unstable:

gcc (GCC) 4.0.3 20060128 (prerelease) (Debian 4.0.2-8)

Reading the info pages on gcc has not revealed what I am looking
for. Hence my question....

__FILE__ contains whatever path is given to the compiler.

consider a simple 'test.c' ...

#include <stdio.h>
int main(void){puts(__FILE__); return 0;}

If you compile test.c like this: gcc -E test.c

You will see __FILE__ is "test.c".

If you compile it like this gcc -E ./test.c

You will see __FILE__ is "./test.c".

*Not a pedant*