Re: OID unsigned long long - Mailing list pgsql-hackers

From David Ford
Subject Re: OID unsigned long long
Date
Msg-id 3B7B3137.3070100@erisksecurity.com
Whole thread Raw
In response to OID unsigned long long  (mlw <markw@mohawksoft.com>)
List pgsql-hackers
Tom Lane wrote:

>[...]
>
>BTW, I think #ifdef would be a totally unworkable way to attack the
>format-string problem.  The code clutter of #ifdef'ing everyplace that
>presently uses %u would be a nightmare; the impact on
>internationalization files would be worse.  And don't forget that %llu
>would be the right thing on only some machines; others like %qu, and
>DEC Alphas think %lu is just fine.  The only workable answer I can see
>is for the individual messages to use some special code, maybe "%O" for
>Oid.  The problem is then (a) translating this to the right
>platform-dependent thing, and (b) persuading gcc to somehow type-check
>the elog calls anyway.
>

You can ask gcc to typecheck format strings for printf type functions 
with something like the following:

extern int
my_printf (void *my_object, const char *my_format, ...)     __attribute__ ((format (printf, 2, 3)));


Ref: http://www.delorie.com/gnu/docs/gcc/gcc_77.html

David




pgsql-hackers by date:

Previous
From: "Nicolas Verger"
Date:
Subject: RE: Select parser at runtime ....
Next
From: joseph.castille@wcom.com (Joseph Castille)
Date:
Subject: How would I make a table of autonumbers/sequences?