'splain this, somebody:
Code:
#define STRAIGHT_DRIVE_DIRECTION ( 127 + 30 )
static int steeringValue = 0;
. . .
steeringValue = (int) ((STRAIGHT_DRIVE_DIRECTION));
printf( "nav: DTC %3d ", steeringValue );
That printed a value of -99! Why?
Changing the assignment to:
Code:
steeringValue = (int) ((unsigned char) (STRAIGHT_DRIVE_DIRECTION));
made it print "157" as expected the first time.
Is this weird, or is there something about type casting I don't understand?
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the
USPTO.
My favorite error message from gcc:
main is usually a function
My favorite error message from Windows:
There is not enough disk space available to delete this file.