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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Elimination of (more or less) all compilation warnings on OSX
Date: 2014-03-06 16:50:51
Message-ID: 27047.1394124651@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Heikki Linnakangas <hlinnakangas(at)vmware(dot)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

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Przemyslaw Rzepecki 2014-03-06 17:05:07 Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.
Previous Message Heikki Linnakangas 2014-03-06 16:04:38 Re: Elimination of (more or less) all compilation warnings on OSX