Re: MinGW / Windows / printf format specifiers

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MinGW / Windows / printf format specifiers
Date: 2016-02-19 07:57:01
Message-ID: CAMsr+YGh1fhc5f4JnA1HSi5o+tdndfKvVA-5q8VzJSOWQV738w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19 February 2016 at 12:15, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:

>
> The cause seems to be that Windows conventions have int = long = int32
> (even on 64-bit platforms) and only 'long long' = int64.

Yes, it's an LLP64 platform.

https://en.wikipedia.org/wiki/64-bit_computing

> The Java JNI
> headers of course know this, so they type jlong as 'long long', while
> jint they type as 'long' - curiously, because they could just call it
> int and get the same width. Maybe a habit from a 16-bit C environment?
>

They should be using the (u)int(nn)_t typedefs like int64_t, but some
compilers lag in their support for them.

> Have issues like this been dealt with in PostgreSQL code before, and did
> a favorite approach emerge?
> <http://www.postgresql.org/mailpref/pgsql-hackers>

INT64_FORMAT and UINT64_FORMAT

src/include/c.h

git grep INT64_FORMAT

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2016-02-19 08:30:03 [PoC] WaitLatchOrSocketMulti (Re: Performance degradation in commit ac1d794)
Previous Message Michael Paquier 2016-02-19 07:33:21 Re: WAL logging problem in 9.4.3?