Re: Safer and simpler HTAB macros (foreach_hash and hash_make), take two

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, bertranddrouvot(dot)pg(at)gmail(dot)com, hlinnaka(at)iki(dot)fi
Subject: Re: Safer and simpler HTAB macros (foreach_hash and hash_make), take two
Date: 2026-11-30 23:31:20
Message-ID: CAN4CZFPxOxTXB+N4j71HFxF59r1vPxdFuEbK1k_-Kn6QMYCt_g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

+#define HASH_TYPE_AS_STRING(type) \
+ HASH_PTR_AS_STRING(static_cast<std::add_pointer_t<type>>(nullptr),
sizeof(type))
+#else

this uses c++14 and currently the project requires only 11.

And similarly

+#define HASH_MAKE_OPTS(...) (HASHOPTS){__VA_ARGS__}

hash_make(E, key, "name", 8) expands to (HASHOPTS){}, which is C23

Also:

typedef struct { char key[8]; int v; } E8;
HTAB *h = hash_make(E8, key, "short key", 16);

TRAP: failed Assert("info->keysize > 8"), File: "dynahash.c", Line: 439

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Zsolt Parragi 2026-11-30 23:00:11 Re: [PATCH] GROUP BY ALL: the regroupening