In article <4857ed5a$0$12713$>,
says...
[ ... ]
> Right, but using 'a' as an index into an array could be a different
> index on different compilers. considering that char could be signed and
> negative, you could have serious consequences.
>
> Granted, this isn't a problem in practice, but its not portable that
> foo['a'] = 1 should do something specific.
That depends on what you mean by something specific. Basically, the
behavior is unspecified, but NOT undefined. In particular, the C++
standard specifies a basic execution character set that includes the
usual English letters, base-10 digits, etc. and requires that all those
characters have non-negative values. Since the 'a' in your expression
must be non-negative, it has defined results if (for example) foo has
been defined something like 'int foo[UCHAR_MAX];'
It's certainly true that you could encounter characters whose encoding
is negative, but this isn't one of them.
--
Later,
Jerry.
The universe is a figment of its own imagination.