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