Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, if you're storing int values and then re-retrieving those same int values later then it doesn't matter how they're stored underneath (e.g., big/little endian).</p> <p>For example, suppose you define</p> <pre><code>int a = 0xaabbccdd; </code></pre> <p>On a little endian system this will be stored as <strong>0xdd 0xcc 0xbb 0xaa</strong> in memory. On a big endian system this will be stored as <strong>0xaa 0xbb 0xcc 0xdd</strong>. However, when you view this memory as an <strong>int</strong> it will always be viewed as 0xaabbccdd. Now, if you viewed sub-portions of the original memory (e.g., a sub portion of the int value in memory) endianness would come into play. For example, suppose you only read the first two bytes from the memory location where the int is stored:</p> <pre><code>int *ptr = &amp;a; short firstTwoBytesInMemory = *(short*)ptr; </code></pre> <p>The value of firstTwoBytesInMemory will be 0xccdd on a little endian system, and 0xaabb on a big endian system.</p> <p><strong>Update:</strong> To extend this further, structs are essentially collections of primitive types (e.g., bytes, ints, pointers to other things, etc.). These primitive types are usually laid out in memory contiguously (with some exceptions for alignment, etc). So the same rules that apply to the int/short example above apply to collections of primitive types (e.g., structs).</p> <p>If you start accessing sub-portions of variables then the endianness of the architecture will matter, but if you always deal with things in their correct types (e.g., int, double, etc.) in their entirety the way things are stored underneath should be transparent.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload