__FILE__ In .h what does it resolve to

Posted by Pablitorun on Stack Overflow See other posts from Stack Overflow or by Pablitorun
Published on 2011-02-18T23:20:16Z Indexed on 2011/02/18 23:25 UTC
Read the original article Hit count: 163

Filed under:
|
|
|

Is there a specification on how the FILE macro will be expanded if it is in a .h?

So

if I

#define MYFILE __FILE__

in foo.h

and foo.c

#includes "foo.h"

void main(){

printf("%s",MYFILE);
....

does this output foo.h or foo.c? (Yes I realize this is a stupid example)

Sorry for what should be a simple question. The documentation on the web seems conflicting. For what it is worth VS2008 comes back as foo.c which is what I would expect....I think. I am just trying to confirm if this is defined behavior.

© Stack Overflow or respective owner

Related posts about c

    Related posts about compiler