http://stackoverflow.com/questions/216510/extern-inline inline void printLocation() { cout <<"You're at " __FILE__ ", line number" __LINE__; } { ... printLocation(); ... printLocation(); ... printLocation(); ------------------------------------------------- and hoping that you'll get different values printed each time. As Don says, you won't, because __FILE__ and __LINE__ are implemented ..