Re: understand char type - warning: noob question :) by Igor
Igor
Thu Jun 08 19:53:40 CDT 2006
"Stick" <Stick@discussions.microsoft.com> wrote in message
news:C5EE65E8-9B1D-47A3-B06C-67E12F32A622@microsoft.com
> In reviewing the basics, I've just learned that:
>
> int var;
>
> is equivilent (at least on my Windows box) to:
>
> signed var; // meaning it defaults to signed.
>
> and this made me explore what a char type might default to. However,
> as one must cast a char variable to an int to output it as anything
> but a char, it would seem that there is no meaning to this question.
char, signed char and unsigned char are three distinct types. char must
have the same range of values as either signed char or unsigned char -
it is implementation-defined which one (and it's still a distinct type,
e.g. for the purposes of overload resolution).
On VC++, char defaults to being signed, but this can be changed with /J
compiler switch.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925