Thread: I hate "C"
View Single Post
  #8   Spotlight this post!  
Unread 20-01-2007, 00:52
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: I hate "C"

http://www.drpaulcarter.com/pcasm/

Well, you can't really call this a paper, but it's certainly got what you're looking for, and then some. It's one of the most influential documents in my "career" as a programmer. It deals with assembly language, the lowest programming language there is, unless you count binary as a language. It's pretty mind-boggling stuff, but if you can grasp the basic concepts, you won't believe how much your programming skills will improve. If you can learn and understand assembly, diagnosing code and logic problems will become almost intuitive and you'll be just as much better at coding them in the first place. Knowing assembly gives you a deep understanding of how C and other languages actually work, and how computers and processors themselves work. Of course you could just skip to the section on the Stack, and other things, but I'd recommend reading as much of it as you can, eventually.

However, you do still have a slight problem, I believe. You're casting your 4 byte longs as 2 byte ints. So, when looking at the prints, it may seem like they're overflowing, because you're not seeing the entire variable through the printf function. In memory, though, the value is not overflowing (if it's large enough to overflow 2 bytes) because its being stored as 4 bytes. If you wanted to see the whole variable, you need to use a printf escaped character (like %i and %d) that is used for longs. I can't remember what it is at the moment, though.
__________________
Code:
void function(void)
 {
  function();
 }

Last edited by Jake M : 20-01-2007 at 01:16.