Andrew Tridgell tridge at
Fri Jul 31 04:09:14 GMT 1998

> We already do this all over the place

in a _few_ places. There is no way I am going to build this into our
debug code.

> Another problem with file:line is that __LINE__ is an int while
> __FUNCTION__ is a string.  That means that you really have to decide (at
> config or compile time) which format you are going to use.  Can't have it
> both ways. 

that's why I added HAVE_FUNCTION_MACRO

> We *probably* have file:line availalble on all platforms

we do.

if we ever find a platform (we won't) that doesn't have __LINE__ and
__FILE__ then we add a test for them and they don't get the strings in
the output at all. 

> I already know that SGI doesn't have __FUNCTION__ (pain).

sure, I knew that __FUNCTION__ is only available on some systems. 

> My opinion is that the function name is much more useful than the line
> number.  The function names in nmbd are very descriptive (haven't done
> enough digging into smbd yet), so it's quite helpful to have them.

helpful, yes. essential, no.

> - If __FUNCTION__ is available, then we would use file:function().
> - If it's not, then we would use file:line.

yep, that's what I said.

> - In either case, the first line of the body of the message could be the
>   function name, typed in by the programmer. 

nope. I don't want to have a debug system require that the programmer
add the function name or file name anywhere but at the start of the
function. No way.

> This last is, as I've mentioned, already done in many places because 
> people really do use the function name.

sure, in some places it is useful. 

we have (quick count) 3239 DEBUG() statements in Samba. Maybe a couple
of dozen of those have the function name in them now. 

Can you imagine the nightmare of keeping those thousands of debug
statements correct? They won't stay correct. That is the nature of
Anything that makes programming less enjoyable and more painful is
out. This will make it a heck of lot less enjoyable for me.

     Cheers, Tridge

More information about the samba-technical mailing list