Re: [HACKERS] static assertions in C++ - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] static assertions in C++
Date
Msg-id 19b3da77-9276-76aa-8852-f01439a7c7d6@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] static assertions in C++  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] static assertions in C++  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 12/11/17 17:12, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> On 12/11/17 16:45, Tom Lane wrote:
>>> (BTW, why is it that we can't fall back on the negative-width-bitfield
>>> trick for old g++?)
> 
>> The complaint is
>> error: types may not be defined in 'sizeof' expressions
> 
> Hmm, well, surely there's more than one way to do that; the sizeof
> is just a convenient way to wrap it in C.  Wouldn't a typedef serve
> just as well?

Here is another attempt, which has the desired effect with the handful
of compilers I have available.

(With the recent changes to AllocSetContextCreate() using a static
assertion, the current state now breaks actual extensions written in C++
in some configurations, so this has become a bit of a must-fix for PG11.)

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

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: File name as application name in regression tests and elsewhere
Next
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] Assertion failure when the non-exclusive pg_stop_backup aborted.