On Sat, 8 Nov 2003 17:53:32 +0100, "Severin Ecker" <secker@gmx.at>
wrote in comp.lang.c++:
[color=blue][color=green]
> > function signature -
> > void foo(short);
> >
> > function call -
> > foo('d');
> >
> > My compiler does not complain when I call foo() with a character argument.[/color]
> thats because a char(acter) is nothing more than a number (char from -128 to
> 127 or unsigned char from 0 to 255)[/color]
No, a character is nothing more than a number between CHAR_MIN, which
must be at least -127 if char is signed or 0 if char is unsigned, and
CHAR_MAX which must be at least 127 if char is signed or 255 if char
is unsigned. No C++ implementation is required to support a character
with a value of -128, although some do.
And on one compiler that I use a lot these days, a char can have any
value between -32768 and +32767.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
ftp://snurse-l.org/pub/acllc-c++/faq