lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 02.06.2011 20:47, schrieb Marc Balmer:
Am 02.06.2011 19:44, schrieb liam mail:


On 2 June 2011 18:09, Tony Finch <dot@dotat.at <mailto:dot@dotat.at>>
wrote:

Marc Balmer <marc@msys.ch <mailto:marc@msys.ch>> wrote:
>
> What does the standard say is*() should return if the argument is
EOF?
> Is that specified at all?

It seems to be unspecified. This is probably a bug in the standard.
Here's a link to C99 with all the technical corrigenda included. The
relevant part is section 7.4 starting on page 181.

http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf

Tony.
--
f.anthony.n.finch <dot@dotat.at <mailto:dot@dotat.at>> http://dotat.at/
Rockall, Malin, Hebrides: South 5 to 7, occasionally gale 8 at first in
Rockall and Malin, veering west or northwest 4 or 5, then backing
southwest 5
or 6 later. Rough or very rough. Occasional rain. Moderate or good,
occasionally poor.



Although the C99 standard does not state it, the C99 rationale v5.1[1]
does
"*7.4.1Character classification functions *
**The definitions of /printing character /and /control character /have
been generalized from ASCII.
Note that none of these functions returns a nonzero value (true) for the
argument value *EOF*."

So if Microsoft claims to be in support of the C99 standard, this is
clearly a bug in their implementation of the SDK. And since they don't
have a friendly mailing list and community like Lua does, I am fucked.

Seems like I have to take is*() from another system, just to be sure...


[1] http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf

for general amusement, this is how to make a microsoft compiler halfway standards compliant:

#undef isalnum
#define isalnum(_c)      ( _c == EOF ? 0 : _isctype(_c,_ALPHA|_DIGIT) )
#undef isdigit
#define isdigit(_c)      ( _c == EOF ? 0 : _isctype(_c,_DIGIT) )