pepke@gw.scri.fsu.edu (Eric Pepke) (02/22/90)
There is a gotcha concerning character constants when upgrading from Think
C 3.0 to Think C 4.0. In 3.0, a single character constant is of type int
and will always have a positive value. In 4.0, single character constants
undergo sign extention during promotion, so all characters with codes
greater than 127 will be negative.
One of the upshots of this is that comparisons will behave differently.
Consider the following contrived example:
unsigned char letter;
letter = '\377';
if (letter == '\377')
{
printf("Yah bro. This is 3.0 or earlier.\n");
}
else
{
printf("Nah bro. This is 4.0 or later.\n");
}
Eric Pepke INTERNET: pepke@gw.scri.fsu.edu
Supercomputer Computations Research Institute MFENET: pepke@fsu
Florida State University SPAN: scri::pepke
Tallahassee, FL 32306-4052 BITNET: pepke@fsu
Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.