Re: [HACKERS] static assertions in C++

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] static assertions in C++
Дата
Msg-id 19b3da77-9276-76aa-8852-f01439a7c7d6@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] static assertions in C++  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] static assertions in C++  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: File name as application name in regression tests and elsewhere
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: [HACKERS] Assertion failure when the non-exclusive pg_stop_backup aborted.