Re: Add %z support to elog/ereport?

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 17:58:32
Message-ID: 20140123175831.GI7182@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

> I'm inclined to just print (size_t)0xFFFFFFFF and see if it produces
> the expected result.

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. And I
couldn't think of a better way to test that both for 32 and 64 bit
platforms...

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-01-23 18:09:22 Re: Closing commitfest 2013-11
Previous Message Tom Lane 2014-01-23 17:54:22 Re: Add %z support to elog/ereport?