Go to Post Yup. Two world champs on one alliance, out in the quarterfinals. Only at IRI. - Norman J [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 22-03-2004, 14:02
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
What the...? casting bug?

'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.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
printf bug - beware! WizardOfAz Programming 8 10-03-2004 09:50
bug? Duke 13370 CD Forum Support 4 30-12-2003 21:44
Gingery Lathe - Metal Sand Casting sanddrag General Forum 13 14-08-2003 21:41
Last Call for bug reports rbayer Programming 0 08-01-2003 02:48
Small bug Jay Lundy CD Forum Support 1 18-06-2001 17:03


All times are GMT -5. The time now is 23:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi