Re: space reserved for WAL record does not match what was written: panic on windows - Mailing list pgsql-hackers

From Noah Misch
Subject Re: space reserved for WAL record does not match what was written: panic on windows
Date
Msg-id 20131018204618.GA368286@tornado.leadboat.com
Whole thread Raw
In response to Re: space reserved for WAL record does not match what was written: panic on windows  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On Fri, Oct 18, 2013 at 09:05:38PM +1300, David Rowley wrote:
> As for signed vs unsigned, I've not looked at all of the places where
> MAXALIGN is used, but I just assumed it was for memory addresses, if this
> is the case then I'm confused why we'd ever want a negative valued memory
> address?

The result will invariably be cast to a pointer type before use, at which
point it's no longer negative.  (That's not to say we should keep using signed
math, but it doesn't cause active problems for memory addresses.)

> This might be an obvious one, but can anyone tell me why the casts are in
> the macro at all? Can a compiler not decide for itself which type it should
> be using?

The casts allow passing values of pointer type, which are not valid as
arguments to the bitwise AND operator.

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Turning recovery.conf into GUCs
Next
From: Josh Berkus
Date:
Subject: Re: Turning recovery.conf into GUCs