Re: Warnings in compile

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Warnings in compile
Дата
Msg-id 4263.1243267849@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Warnings in compile  (Michael Meskes <meskes@postgresql.org>)
Ответы Re: Warnings in compile  (Michael Meskes <meskes@postgresql.org>)
Re: Warnings in compile  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-hackers
Michael Meskes <meskes@postgresql.org> writes:
> On Mon, May 25, 2009 at 11:27:27AM -0400, Tom Lane wrote:
>> You can't just remove the "else", or it's unsafe;

> But why? What does this empty else accomplish?

Consider
if (...)    macro;else    something-else;

Without the "else" in the macro, this code would be parsed
in a surprising fashion, ie else bound to the wrong if.
I'm afraid that "else {}" might not be any better --- it
might fail outright in this context.

[ thinks for a bit... ]  What might be both safe and warning-free
is to code an explicit empty statement, viz macro body as
if (1) { ... } else ((void) 0)
        regards, tom lane


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

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: problem with plural-forms
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)