File and line numbers in error messages
Russ Allbery
rra at stanford.edu
Tue Apr 28 18:42:27 EDT 2009
Ken Raeburn <raeburn at MIT.EDU> writes:
> On Apr 28, 2009, at 15:37, ghudson at MIT.EDU wrote:
>> #define krb5_set_error_message(ctx, code, fmt, ...) \
>> krb5_set_error_message_fl(ctx, code, __FILE__, __LINE__, fmt, ##
>> __VA_ARGS__)
> Even without the gcc bits, if you have C99 support it's doable. I
> don't know what you'd do for Windows though, where we're stuck with
> VS2003. I guess you could have it permanently disabled there, along
> with pre-C99 non-GCC platforms.
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.)
--
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
More information about the krbdev
mailing list