Re: pgsql: Provide some static-assertion functionality on all compilers.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Provide some static-assertion functionality on all compilers.
Дата
Msg-id 3708.1350424248@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Provide some static-assertion functionality on all compilers.  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: pgsql: Provide some static-assertion functionality on all compilers.  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-committers
Andres Freund <andres@2ndquadrant.com> writes:
> On Monday, October 01, 2012 04:46:41 AM Tom Lane wrote:
>> Provide some static-assertion functionality on all compilers.

> The current method used here doesn't allow the macro to be used in file scope
> which imo would be rather useful. What about adding something like:

I deliberately didn't go that way, because I didn't see any methods to
do it that weren't utter hacks, with deficiencies like this one:

> Annoyingly that would mean you cannot have two errors in the same line
> in two files that are in one translation unit if your compiler doesn't
> allow repeated typedefs. Not sure if thats a realistic problem?

If it came up even once, it would annoy people no end.  I don't see any
very strong reason not to just put the assertions inside functions
instead.

> Independently from this it might be worthwile to add the __LINE__ hackery to
> the existing fallback for StaticAssertStmt?

Uh, why?  It's going to be a static compile error, so surely your
compiler will give you a line number already.

            regards, tom lane


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Provide some static-assertion functionality on all compilers.
Следующее
От: Simon Riggs
Дата:
Сообщение: pgsql: Clarify hash index caution and copy to CREATE INDEX docs