[cfe-users] App security and the __FILE__ macro

Steffen Hirschmann via cfe-users cfe-users at lists.llvm.org
Fri Apr 13 23:52:19 PDT 2018


On 13:22 Fri 13 Apr     , Rick Mann via cfe-users wrote:
> I'm using `strrchr("/" __FILE__, '/') + 1`. Should that also get resolved?
Just have a look at a minimal example on godbolt:
https://godbolt.org/g/MRjGG3

Indeed the function call gets resolved at compile time. But that does
not mean that only the basename of __FILE__ is present in the binary.
No compiler that you can test on godbolt does this actually, neither
with -O3 nor with -Os.




More information about the cfe-users mailing list