Re: Elimination of (more or less) all compilation warnings on OSX

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Elimination of (more or less) all compilation warnings on OSX
Дата
Msg-id 27047.1394124651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Elimination of (more or less) all compilation warnings on OSX  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Ответы Re: Elimination of (more or less) all compilation warnings on OSX  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-odbc
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> It's worth noting that isspace, isdigit etc. take an "unsigned char"
> argument. The compiler won't warn if you pass a "char", so you have to
> be careful with that. In practice, I don't think it will lead to actual
> bugs on any real platform and locale, but still..

It definitely used to lead to bugs on some old platforms.  It may be
that everybody is more careful nowadays, but the POSIX spec is still
perfectly clear about it:

      The c argument is an int, the value of which the application
      shall ensure is a character representable as an unsigned char or
      equal to the value of the macro EOF. If the argument has any
      other value, the behavior is undefined.

I had my old HPUX box hacked up so that gcc would produce "subscript
is a char" warnings for unsafe usage.  It seems a bit more difficult to
get modern platforms to do that, though; people stopped exposing the
underlying flag array in the system headers ...

            regards, tom lane


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Elimination of (more or less) all compilation warnings on OSX
Следующее
От: Przemyslaw Rzepecki
Дата:
Сообщение: Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.