Re: OID unsigned long long

From: David Ford <david(at)erisksecurity(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: OID unsigned long long
Date: 2001-08-16 02:34:31
Message-ID: 3B7B3137.3070100@erisksecurity.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alessio Bragadini 2001-08-16 06:18:25 Re: Why is SERIAL a keyword?
Previous Message Tatsuo Ishii 2001-08-16 01:10:40 Re: encoding names