|
#13
|
||||
|
||||
|
Re: I hate "C"
Quote:
dcbrown's explanation is correct. When viewed from a pure "software" perspective, the fact that this processor passes parameters on the stack is, perhaps, confusing. C allows a variable argument list and it is up to the called function (in this case, printf) to parse the format string (the first parameter of the function is actually a pointer to a string) and determine how many variables there are and how large each one is. Your first %d in your format string indicated a 2 byte variable was the second parameter on the stack. When you put a long variable in the calling statement, 4 bytes were pushed onto the stack. That meant that all of your subsequent parameters were 2 bytes off... I would refer you to K&R for more details. It was the bible back in the 70's and, in my opinion, it is still the bible. For specifics on C as implemented for this processor, I'd look here. Regards, Mike |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" | Jessica Boucher | Team Organization | 0 | 10-08-2005 10:55 |
| "Thunderbirds" Vs. "Team America" Which one will rule the box office? | Elgin Clock | Chit-Chat | 3 | 07-09-2004 19:53 |
| Conflict between "Initialize_Tracker()" and "pwm13 & pwm15"? Kevin? | gnormhurst | Programming | 3 | 22-02-2004 02:55 |
| how tall is the ramp when in "up" and "balanced" position??? | archiver | 2001 | 1 | 24-06-2002 00:54 |
| I "hate" the new first site | Dima | General Forum | 11 | 06-01-2002 19:40 |