Re: Further news on Clang - spurious warnings

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Further news on Clang - spurious warnings
Дата
Msg-id CAEYLb_U=pgfjQXN6mXBsFJSr_hK04dAEzKJkW7C=_jzDvLa+7A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Further news on Clang - spurious warnings  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Ответы Re: Further news on Clang - spurious warnings  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Re: Further news on Clang - spurious warnings  (Peter Geoghegan <peter@2ndquadrant.com>)
Список pgsql-hackers
On 3 August 2011 10:34, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> The check is only tautological if the compiler implements enums as unsigned
> integers. Whether enums are signed or not is implementation-dependent.
> Perhaps cast status to unsigned or signed explicitly before the checks?

I don't believe that the standard allows for an implementation of
enums as unsigned integers - after all, individual enum literals can
be given corresponding negative integer values.

This warning is only seen because the first enum literal in the enum
is explicitly given the value 0, thus precluding the possibility of
the value being < 0, barring some abuse of the enum.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Further news on Clang - spurious warnings
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Further news on Clang - spurious warnings