Re: Proposal: Add more compile-time asserts to expose inconsistencies.

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, "Smith, Peter" <peters(at)fast(dot)au(dot)fujitsu(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Add more compile-time asserts to expose inconsistencies.
Date: 2019-11-14 14:54:02
Message-ID: 05762932-98f3-9504-d885-7d690623deed@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-11-12 20:00, Andres Freund wrote:
> Looking at the cplusplus variant, I'm somewhat surprised to see that you
> made both fallback and plain version unconditionally use GCC style
> compound expressions:

> Was that intentional? The C version intentionally uses compound
> expressions only for the _Static_assert case, where configure tests for
> the compound expression support? As far as I can tell this'll not allow
> using our headers e.g. with msvc in C++ mode if somebody introduce a
> static assertion in a header - which seems like a likely and good
> outcome with the changes proposed here?

I don't recall all the details anymore, but if you're asking, why is the
fallback implementation in C++ different from the one in C, then that's
because the C variant didn't work in C++.

I seem to recall that I did this work in order to get an actual
C++-using extension to compile, so it worked(tm) at some point, but I
probably didn't try it with a not-gcc compatible compiler at the time.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-11-14 14:58:03 Re: Invisible PROMPT2
Previous Message Antonin Houska 2019-11-14 14:48:31 Re: MarkBufferDirtyHint() and LSN update