[linux-elitists] Stupid C tricks

Tilghman Lesher zgp-org@the-tilghman.com
Fri Aug 27 20:09:27 PDT 2004


On Friday 27 August 2004 21:29, Jason Spence wrote:
> On Fri, Aug 27, 2004 at 09:16:40PM -0500, Tilghman Lesher wrote:
> > On Friday 27 August 2004 20:46, Jason Spence wrote:
> > > Something that's been bugging me for a while was the inability
> > > to have an error reporting macro that automatically outputted
> > > the filename and line number of the call to the macro, as well
> > > as take variable arguments in printf(3) format so the
> > > programmer could provide some information on the state of the
> > > program at the time the error occured.
> > >
> > > I figured it out a way to get both last month; please let me
> > > know what you think.
> > >
> > > http://lightconsulting.com/~thalakan/drop/ngdebug.c
> >
> > I'm missing something.  Why aren't you just using __FILE__,
> > __LINE__, and __PRETTY_FUNCTION__?
>
> More typing, no centralization of the output format, and you have
> to sync more stuff in the format string with the arguments

The Asterisk project is a fine example where such centralization has
been achieved, with really very little work.

http://nlug.org/url/?u=18

> (especially bad for compilers like MS C w/o prefast that don't
> support something like GCC's __attribute((format(printf))) ).  It's

Linux elitists use MS C?

-Tilghman



More information about the linux-elitists mailing list