Re: static assertions in C++

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: static assertions in C++
Date: 2017-08-31 22:37:09
Message-ID: 11631.1504219029@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Aug 31, 2017 at 4:43 PM, Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>> As discussed in
>> <https://www.postgresql.org/message-id/7775.1492448671@sss.pgh.pa.us>, a
>> more general solution would be to add specific C++ support for static
>> assertions in c.h. Here is a patch for that, extracted from my
>> previously posted C++ patch set, but also a bit reworked from what was
>> previously posted.

> I like the concept of being more C++-compatible, but I'm not sure
> about the idea of not providing a workaround,

Meh. We support ancient versions of C for backwards compatibility
reasons, but considering that compiling backend code with C++ isn't
officially supported at all, I'm not sure we need to cater to ancient
C++ compilers. We could quibble about the value of "ancient" of
course --- Peter, do you have an idea when this construct became
widely supported?

I do think it might be a better idea to put a #error there instead
of silently disabling static assertions. Then at least we could
hope to get complaints if anyone *is* trying to use ancient C++,
and thereby gauge whether it's worth working any harder for this.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-08-31 23:28:40 Re: static assertions in C++
Previous Message Robert Haas 2017-08-31 21:42:59 Re: static assertions in C++