Re: remove bits* types - Mailing list pgsql-hackers

From Tom Lane
Subject Re: remove bits* types
Date
Msg-id 1297170.1773937330@sss.pgh.pa.us
Whole thread Raw
In response to Re: remove bits* types  (Álvaro Herrera <alvherre@kurilemu.de>)
List pgsql-hackers
=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@kurilemu.de> writes:
> On 2026-Mar-18, Robert Haas wrote:
>> I'm not entirely sure that this is worth standardizing at all; if
>> someone thinks that using bits8 or whatever makes the code more rather
>> than less clear in a certain context, who am I to argue? If someone
>> else prefers uint8 in another context, also fine.

> I don't think we _have_ to force our hand one way or the other.

I'm content with the status quo personally, but perhaps it'd be
worth adding some info to the comment for the bitsNN typedefs
to make it clearer what they are intended for.  I'm imagining
something along the lines of

 /*
  * bitsN
  *        Unit of bitwise operation, AT LEAST N BITS IN SIZE.
+ *
+ * Use these type names for values that are intended to be manipulated
+ * as sets of bits, for example bitmasks of flags, null bitmaps, etc.
+ * If it'd be sensible to do arithmetic on it, it's not a set of bits.
  */
 typedef uint8 bits8;            /* >= 8 bits */
 typedef uint16 bits16;            /* >= 16 bits */
 typedef uint32 bits32;            /* >= 32 bits */


            regards, tom lane



pgsql-hackers by date:

Previous
From: Jianghua Yang
Date:
Subject: [PATCH] Fix fd leak in pg_dump compression backends when dup()+fdopen() fails
Next
From: Robert Haas
Date:
Subject: Re: dshash_find_or_insert vs. OOM