From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-03-12 12:44:31
On 12 Mar 2003 13:25:36 +0100, larsbj_at_[hidden] (Lars Gullik Bjønnes)
>With GCC 3.3. there are a couple of warnings in the regex lib.
>The warnings is about of the type of the array index.
>Warning about char being used as index.
>This patch fixes that. (by casting to unsigned int).
Actually you are casting to unsigned char. That's safe whether plain
chars are signed or not, because for 3.9.1/3 the range of nonnegative
values of a signed integer type is a subrange of the corresponding
unsigned integer type *and* you are converting only members of the
basic execution character set (guaranteed to be non-negative by
For arbitrary characters (and plain char = signed char) though that's
not a reassuring practice.
Had I proposed the patch, I would have probably suggested adding 0 to
trigger integral promotion; e.g.:
class_map[ 0 + '_'] |= char_class_underscore;
BTW I found the program confusing as to what kind of indexing is
intended for class_map (because if one wants to use arbitrary chars to
index an array one declares it as:
T arr [CHAR_MAX - CHAR_MIN + 1];
and not as
T arr [UCHAR_MAX + 1];
In either case, then I don't see why indexing by unsigned int, like in
Also, the calls to memset look suspicious, but I've not investigated
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk