pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] Task #7792: Design of the Error Module


From: Aleksander Morgado
Subject: Re: [pdf-devel] Task #7792: Design of the Error Module
Date: Fri, 22 Feb 2008 11:19:06 +0100
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)

Hi Gerel,

Hey everyone,

I've just finished a draft of what should be the Error Module API:

http://www.gnupdf.org/Task7792

As always, suggestions and/or swearwords :-) are welcome.

Just two comments.

I wouldn't include __FILE__ and __LINE__ as arguments to the macro, they can be directly included within it.

And I would use variadic macros for the PDF_DEBUG_* macros, so that extra arguments can be passed to be printed, and not only a string.

Something like...

#define PDF_DEBUG_BASE(message, ...) do {\
    fprintf(stderr, "%s:%s:%d: ", program_name, __FILE__, __LINE__); \
    fprintf(stderr, message, __VA_ARGS__); \
    fprintf(stderr, "\n"); \
} while(0)

So that you can call it, for example, as:

PDF_DEBUG_BASE("Testing macro '%s' '%d' '%lf'", "string", 7, 10.1);


What do you think?

-Aleksander




reply via email to

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