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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Proposal: Add more compile-time asserts to expose inconsistencies.
Дата
Msg-id 16425.1569864054@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Andres Freund <andres@anarazel.de>)
Ответы Re: Proposal: Add more compile-time asserts to expose inconsistencies.  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2019-09-19 04:46:27 +0000, Smith, Peter wrote:
>> In the attached patch example I have defined a new macro
>> StaticAssertDecl. A typical usage of it is shown in the relpath.c
>> file.

> I'm in favor of adding that - in fact, when I was working on adding a a
> static_assert wrapper, I was advocating for only supporting compilers
> that know static_assert, so we can put these in the global scope. The
> number of compilers that don't support static_assert is pretty small
> today, especially compared to 2012, when we added these.
> https://www.postgresql.org/message-id/E1TIW1p-0002yE-AY%40gemulon.postgresql.org
> https://www.postgresql.org/message-id/27446.1349024252%40sss.pgh.pa.us
> Tom, you were arguing for restricting to file scope to get broader
> compatibility, are you ok with adding a seperate *Decl version?

It could use another look now that we require C99.  I'd be in favor
of having a decl-level static assert if practical.

            regards, tom lane



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Two pg_rewind patches (auto generate recovery conf and ensureclean shutdown)
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Proposal: Add more compile-time asserts to expose inconsistencies.