Re: Add %z support to elog/ereport?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add %z support to elog/ereport?
Date: 2014-01-23 18:24:40
Message-ID: 21699.1390501480@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2014-01-23 12:54:22 -0500, Tom Lane wrote:
>> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>>> snprintf(buf64, 100, UINT64_FORMAT, ~(size_t)0);

>> Actually, that coding isn't gonna work at all on platforms where size_t
>> isn't the same size as uint64. We could make it work by explicitly
>> casting the argument to whatever type we've decided to use as uint64
>> ... but unless we want to include c.h here, that would require a lot of
>> extra cruft, and I'm really not sure it's gaining anything anyway.

> Hm, yea, it should be casted. I think we should have the type ready in
> PG_INT64_TYPE, confdefs.h should contain it at that point.

Ah, I'd forgotten that configure defined any such symbol. Yeah, that
will work.

> Well, the reasoning, weak as it may be, was that that we want to see
> whether we successfully recognize z as a 64bit modifier or not.

I'm dubious that this is really adding much, but whatever.

I checked on my HPUX box and find that what it prints for "%zu" is
"zu", confirming my thought that it'd just abandon processing of the
%-sequence. (Interesting that it doesn't eat the "z" while doing
so, though.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-23 18:36:45 Re: Case sensitive mode in windows build option
Previous Message Alvaro Herrera 2014-01-23 18:09:22 Re: Closing commitfest 2013-11