Re: Proposal: Add more compile-time asserts to exposeinconsistencies.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Proposal: Add more compile-time asserts to exposeinconsistencies.
Дата
Msg-id 20191204175447.fazlsemgpeilrcec@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Hi,

On 2019-12-04 10:09:28 +0100, Peter Eisentraut wrote:
> On 2019-12-02 16:55, Andres Freund wrote:
> > > +StaticAssertDecl(lengthof(LockTagTypeNames) == (LOCKTAG_ADVISORY + 1),
> > > +                 "LockTagTypeNames array inconsistency");
> > > +
> > These error messages strike me as somewhat unhelpful. I'd probably just
> > reword them as "array length mismatch" or something like that.
> 
> I'd prefer it if we could just get rid of the second argument and show the
> actual expression in the error message, like run-time assertions work.

Well, _Static_assert has an error message, so we got to pass
something. And having something like "array length mismatch", without
referring again to the variable, doesn't strike me as that bad. We could
of course just again pass the expression, this time stringified, but
that doesn't seem an improvement.

Greetings,

Andres Freund



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Proposal: Add more compile-time asserts to exposeinconsistencies.
Следующее
От: Rushabh Lathia
Дата:
Сообщение: Re: backup manifests