File and line numbers in error messages

Russ Allbery rra at
Tue Apr 28 19:15:38 EDT 2009

Ken Raeburn <raeburn at MIT.EDU> writes:
> On Apr 28, 2009, at 18:42, Russ Allbery wrote:

>> You can do it without requiring either C99 or GCC if you're willing
>> to fall back to using an inline function and provide a version of
>> krb5_set_error_message that takes a va_list instead of variable
>> arguments.  But that might be overkill.  (I do that as a standard
>> part of the error handling library for most of the code I write, if
>> you want to look at a working and tested implementation.)

> If you use __LINE__ in an inline function, you're going to get the  
> line number of the inline function.  So how would you get the correct  
> line numbers added in each call, without changing every call site?

Hm, yeah, I thought I had a solution to that, but it looks like I just
suppress the file and line when neither C99 nor GCC are available.

Russ Allbery (rra at             <>

More information about the krbdev mailing list