title: C programming and error_code variable efficiency
body: <p>Most code I have ever read uses a <code>int</code> for standard error handling (return values from functions and such). But I am wondering if there is any benefit to be had from using a <code>uint_8</code> will a compiler -- read: most C compilers on most architectures -- produce instructions using the immediate address mode -- i.e., embed the 1-byte integer into the instruction ? The key instruction I'm thinking about is the compare after a function, using uint_8 as its return type, returns.</p>
  
  <p>I could be thinking about things incorrectly, as introducing a 1 byte type just causes alignment issues -- there is probably a perfectly sane reason why compiles like to pack things in 4-bytes and this is possibly the reason everyone just uses ints -- and since this is stack related issue rather than the heap there is no real overhead.</p>
  
  <p>Doing the right thing is what I'm thinking about. But lets say say for the sake of argument this is a popular cheap microprocessor for a intelligent watch and that it is configured with 1k of memory but does have different addressing modes in its instruction set :D </p>
  
  <p>Another question to slightly specialize the discussion (x86) would be: is the literal in:</p>
  
  <pre><code>uint_32 x=func(); x==1;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>uint_8 x=func(); x==1;
  </code></pre>
  
  <p>the same type ? or will the compiler generate a 8-byte literal in the second case. If so it may use it to generate a compare instruction which has the literal as an immediate value and the returned int as a register reference. <a href="http://home.comcast.net/~fbui/intel_c.html#cmp" rel="nofollow noreferrer">See CMP instruction types.</a>.</p>
  
  <p><a href="http://siyobik.info/index.php?module=x86" rel="nofollow noreferrer">Another Refference for the x86 Instruction Set.</a></p>