Re: Confused static assertion implementation

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Confused static assertion implementation
Date: 2025-12-15 11:58:40
Message-ID: f763c540-603c-4dc8-bdbd-c58878f49880@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.11.25 23:27, Thomas Munro wrote:
> On Fri, Nov 14, 2025 at 6:18 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> As you added a semi-colon in the line, the one after the empty line can be deleted, though C allows empty statement, but unnecessary, and may lead to confusion for code readers.
>
>> You missed to replace this pgac_cv__static_assert with the new name.
>
> Ugh, yeah, the configure change was hopeless. It looked like it
> worked in configure's stdout, which I mistook for success and posted
> too soon, sorry about that. I have fixed those points and verified
> that pg_config.h actually has the expected value.

I have committed this, with some light editing of the comments.

We are now down to 4 from previously 12 static assertion implementation
variants!

Note, however, that the now committed non-statement-expression fallback
implementation of StaticAssertExpr() does not work under C++. (The
compiler complains about "types may not be defined in 'sizeof'
expressions".) This isn't a regression in the overall sense, since, as
you had mentioned, previously all C++ variants required statement
expressions. So I think this can be added to the list of C++
portability issues that Jelte is currently working through.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2025-12-15 12:12:57 Re: Get rid of "Section.N.N.N" on DOCs
Previous Message Amul Sul 2025-12-15 11:49:00 Re: alter check constraint enforceability