Okay, here's a question about the standard. What does it say about
unsigned/signed mismatches in a comparison statement:
char a = 3;
unsigned char b = 255;
if (a<b)
Now what's the real answer here? If a is converted to unsigned, then b>a.
But, if b is converted to signed,then a>b. What's the correct coversion
(what is the compiler supposed to do?)
--
MiniDisc_2k2
To reply, replace nospam.com with cox dot net.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.e du ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
unsigned/signed mismatches in a comparison statement:
char a = 3;
unsigned char b = 255;
if (a<b)
Now what's the real answer here? If a is converted to unsigned, then b>a.
But, if b is converted to signed,then a>b. What's the correct coversion
(what is the compiler supposed to do?)
--
MiniDisc_2k2
To reply, replace nospam.com with cox dot net.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.e du ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Comment