title: Generating machine code from C
body: <p>Sorry if these are naive questions - I have very little understanding of how C really works at the low level.</p>
  
  <p>So I'm generating machine code to write to some mmap'd memory for execution. I'm confused about the use of hexadecimal literals for generating machine code.</p>
  
  <p>Consider the assembly instruction (AT&amp;T syntax): <code>cmove %edx, %ecx</code>. This has the machine code representation <code>0x0F44CA</code>.</p>
  
  <p>So, would doing something like:</p>
  
  <pre><code>char opcode[3] { 0x0F, 0x44, 0xCA };
  </code></pre>
  
  <p>represent the correct binary string under when 'under the hood'? I suspect it might not, since apparently hexadecimal literals in C are stored as integers. My concern is that, since integers are 32-bit, the actual values getting stored are</p>
  
  <pre><code>0x0000000F 0x00000044 0x000000CA
  </code></pre>
  
  <p>Which is something completely different from what I need.</p>
  
  <p>Another concern I have is, does the type I give to the array affect the value actually being stored? So would</p>
  
  <pre><code>uint8_t opcode[3] { 0x0F, 0x44, 0xCA };
  </code></pre>
  
  <p>or</p>
  
  <pre><code>int opcode[3] { 0x0F, 0x44, 0xCA };
  </code></pre>
  
  <p>be any different from</p>
  
  <pre><code>char opcode[3] { 0x0F, 0x44, 0xCA };
  </code></pre>
  
  <p>under the hood?</p>