Re: signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows)

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows)
Date: 2013-10-17 22:10:17
Message-ID: 20131017221017.GC442708@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

On 2013-10-17 18:04:34 -0400, Noah Misch wrote:
> On Thu, Oct 17, 2013 at 08:27:01PM +0200, Andres Freund wrote:
> > On 2013-10-17 12:33:45 -0400, Noah Misch wrote:
> > > > 1. Is there any guarantee that sizeof(intptr_t) >= sizeof(size_t)?
> > > > (Note that Size is just a typedef for size_t, in c.h)
> > >
> > > C99 doesn't require it, but I have never heard of a platform where it is
> > > false. sizeof(intptr_t) > sizeof(size_t) systems have existed.
> >
> > Either way, both have to be at least 4byte on 32bit platforms and 8byte
> > on 64bit ones. So I as well think we're good.
>
> C99 does not have concepts like "32bit platform" and "64bit platform", so it
> cannot make such a constraint. Nonetheless, I agree we're good with respect
> to implementations actually worth anticipating.

But afaik we indirectly require either 4 or 8 byte pointers or in
configure. And we have a requirement for non-segmented memory afaics. So
both size_t and intptr_t have to be big enough to store a pointer. Which
in turn implies that they have to be at least 4/8 bytes.

> Having said that, changing the ancient macros to use uintptr_t does have the
> advantage you mention, and I'm failing to think of a disadvantage.

+1

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2013-10-17 23:05:24 Multiple psql -c / -f options
Previous Message Noah Misch 2013-10-17 22:04:34 signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows)

Browse pgsql-www by date

  From Date Subject
Next Message David Rowley 2013-10-18 08:05:38 Re: space reserved for WAL record does not match what was written: panic on windows
Previous Message Noah Misch 2013-10-17 22:04:34 signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows)