In a function, is there a way to tell where it was called from (namely, the line and file) without passing parameters? It would be my guess that __LINE__ and __FILE__ contain the line and file that the function is on, not where it was called from.
My current solution would be to pass them as defaulted parameters:
but this seems like a bad way, since the user could specify those parameters and override the wanted behavior. Is there a better way? TIACode:void myFunc( int = __LINE__, char* = __FILE__ );



LinkBack URL
About LinkBacks


