March 13, 2003
I would like to write the file name, line number and function I'm at to a log file.

In C/C++ there is: __FILE__, __LINE__, __FUNCTION__ ( __PRETTY_FUNCTION__ in gcc)

How can this be done in D?

I read in a previous message of something like: build.line or debug.line.

Is this implemented? I tried in dli-0.1.2 but it didn't work.

PS:

A documentation fix is needed in http://digitalmars.com/d/pretod.html

<snip>
#  Lightweight inline functions:
The C Preprocessor Way

	#define X(i)	((i) = (i) / 3)
	

The D Way

	int X(int i) { return i = i / 3; }
	

The compiler optimizer will inline it; no efficiency is lost.
</snip>

The C version sets the value of "i" while the d version doesn't, "i" is passed to the function by value. It should be "inout int i".

Thanks,
-- 
Marcelo Fontenele S Santos <msantos@pobox.com>

March 13, 2003
"Marcelo Fontenele S Santos" <msantos@pobox.com> wrote in message news:b4oula$2t4k$1@digitaldaemon.com...
>
> I would like to write the file name, line number and function I'm at to a log file.
>
> In C/C++ there is: __FILE__, __LINE__, __FUNCTION__ (
> __PRETTY_FUNCTION__ in gcc)
>
> How can this be done in D?

The only way to do this in D right now is to run the C preprocessor over the D source file, and run that result through the D compiler.

> A documentation fix is needed in http://digitalmars.com/d/pretod.html

Thanks, I'll fix it.