Evaluating __FILE__ and __LINE__ of caller?

Adam D. Ruppe destructionator at gmail.com
Fri Mar 2 17:39:46 PST 2012


On Saturday, 3 March 2012 at 01:36:51 UTC, H. S. Teoh wrote:
> 		int opIndex(int x) {

Make that

(int x, string file = __FILE__, int line = __LINE__)

and use file/line in there. The exception consturctors
do this, so you can

throw new Exception("msg", file, line);

and get it passed on.


More information about the Digitalmars-d-learn mailing list