Andres Freund <and...@anarazel.de> writes:
> On 2017-02-15 12:27:11 -0500, Robert Haas wrote:
>> I agree; also, many years ago a guy named Tom Lane told me that flags
>> argument should typically be declared as type "int". I've followed
>> that advice ever since.
> Why is that? I think uint makes a lot more sense for flags where the
> flags are individual bits that set/unset. Doing that with the sign bit
> isn't a good idea.
It would only matter if you got to the point of needing the sign bit
for a flag, which basically never happens for this sort of usage
(or if it does, you'd better be thinking about switching to int64
anyway). So the extra mental and typing load of choosing some other
type than plain old "int" isn't really justified, IMO.
Anyway the real point is that "int" is preferable to "uint8" which
was the original choice here. "uint8" unduly constrains the number
of flags you can add without an ABI break, and on many machines it's
more efficient to pass "int" function arguments than some other width.
regards, tom lane
Sent via pgsql-hackers mailing list (email@example.com)
To make changes to your subscription: