Re: signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows)
От | Noah Misch |
---|---|
Тема | Re: signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows) |
Дата | |
Msg-id | 20131021011013.GA388774@tornado.leadboat.com обсуждение исходный текст |
Ответ на | Re: signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows) (Andres Freund <andres@2ndquadrant.com>) |
Список | pgsql-hackers |
On Fri, Oct 18, 2013 at 12:10:17AM +0200, Andres Freund wrote: > 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. Conformance is possible in an implementation with 8-byte size_t and 4-byte pointers. Filling in the details makes for a decent party game. > > 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 Committed that way, then. -- Noah Misch EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: