Simple implementation of __FUNCTION
Adam D. Ruppe
destructionator at gmail.com
Fri Nov 2 10:55:31 PDT 2012
On Friday, 2 November 2012 at 17:31:55 UTC, Rob T wrote:
> Thanks to input from the D community, I've managed to implement
> a reasonable way to log the name of a calling function.
Huh, that's pretty brilliant!
> The ONLY thing left that I would like to have, is ability to
> display the function signature along with the name.
template __FUNCTION_SIGNATURE() { const char[]
__FUNCTION_SIGNATURE = "typeof(__traits(parent, {})).stringof"; }
int main(string[] args) {
assert(0, mixin(__FUNCTION_SIGNATURE!()));
}
core.exception.AssertError at test4.d(7): int(string[] args)
More information about the Digitalmars-d
mailing list