Topic: __CalledBy __CalledAt and __Id
Author: stan@sabaac.NoSubdomain.NoDomain (Andrew Staniszewski)
Date: 19 Feb 93 18:26:52 GMT Raw View
>This would be very simple for the compiler to provide, but think of
>the cost in run-time overhead. And it's a cost that you would have to
>pay even if you didn't use the feature.
Hmm,
I had thought of that, one syntax that would allow the compiler to handle
reducing the overhead would be to allow default arguments which refer to
__CalledBy __CalledAt and __Id. So that
int func(int a, char * fname = __CalledBy, int line = __CalledAt)
I guess that would make __CalledBy and __CalledAt and __Id reserved words,
but all identifiers starting out with __ are reserved anyhow.
However, this wouldn't work for operators, since they have a predefined number of
arguments.
>Perhaps a better idea would be a library function which does a stack
>walk-back. (This cannot be done in an implementation independant
>manner, so each implementation would have to provide its own.) This
>routine would only be called when a pre-condition wasn't met, so
>normally would only have an adverse effect on code size. If the
>routine was really intelligent, it could exploit debugging information
>in the executable to give you a symbolic walk-back.
hmm, an interesting thought.
In this case you are suggesting that the compiler use an implimentation dependant
method for determining the values of the variables __CalledBy etc.
It sounds resonable, and would doubtless save stack space ...