bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __func__


From: Micah Cowan
Subject: Re: __func__
Date: Thu, 28 Feb 2008 13:36:33 -0800
User-agent: Thunderbird 2.0.0.9 (X11/20071031)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bruno Haible wrote:
> Simon Josefsson wrote:
>>      #  define __func__ "<unknown>"
> 
> Some packages use
>        #define __func__ __FILE__
> in this case. Not perfect, but still more informative than "<unknown>".

But, wouldn't one normally include __FILE__ in diagnostic output, anyway?

#define whine(msg) ((void)fprintf(stderr, "%s(%s:%u): %s", __FILE__,
__func__, __LINE__, (msg)))

(sorry about line-breakage above.)

If they don't do things like that, then yeah, __FILE__ is better than
nothing. If they _do_, though, then it seems like
"file.c(<unknown>:1971): blah" is less confusing than
"file.c(file.c:1971): blah".

Probably better to let the developers use that sort of logic, when they
know how they're using it, than to provide that as the general fallback?

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHxylh7M8hyUobTrERAq5+AJ9Sca2vtCSrDghfIY8MGGuh9FMIrwCfcJuS
u80G1m0OoQv+GGb+NWjZpHc=
=ZeDB
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]