Evaluating __FILE__ and __LINE__ of caller?
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Mar 2 17:38:31 PST 2012
Is it possible to get at the file and line number of where a function is
being called from? For example:
class A {
int opIndex(int x) {
/* do a bunch of checks */
if (checkFailed)
throw new RangeError(...);
/* compute value */
return value;
}
}
I'd like to be able to throw the exception referencing the file/line of
the caller, rather than opIndex() itself. Is this possible?
T
--
Two wrongs don't make a right; but three rights do make a left...
More information about the Digitalmars-d-learn
mailing list