title: Is length of all pointers the same?
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/916051/are-there-are-any-platforms-where-pointers-to-different-types-have-different-size">Are there are any platforms where pointers to different types have different sizes?</a><br>
    <a href="https://stackoverflow.com/questions/1473935/can-the-size-of-pointers-vary-depending-on-whats-pointed-to">Can the Size of Pointers Vary Depending on what&#39;s Pointed To?</a>  </p>
  </blockquote>
  
  
  
  <p>Take 32-bit machine for example. It almost is 32-bit long regardless of what type, inclusive of original type or aggregate type. I think the reason is  pointer is actually a index in the vitual address space, so it has the same length as machine does.</p>
  
  <p>Howerver, the standard does't require this:</p>
  
  <blockquote>
    <p>6.2.5.27:</p>
    
    <p>A pointer to void shall have the same representation and alignment requirements as a pointer to a character type.39) Similarly, pointers to qualified or unqualified versions of compatible types shall have the same representation and alignment requirements. All pointers to structure types shall have the same representation and alignment requirements as each other. All pointers to union types shall have the same representation and alignment requirements as each other. Pointers to other types need not have the same representation or alignment requirements.</p>
  </blockquote>
  
  <p>What is more interesting is that it does't mention the function pointers.</p>
  
  <p><strong>So I want to konw why?</strong>
  Except the truth that in early MS C ,there has so-called far pointer and near pointer, due to the bizarre segment design in early Intel CPU. But nowadays, this is different, the paging and vitual memory will avoid such things.</p>
  
  <p><strong>Another question:</strong></p>
  
  <p><code>void *</code> should be casted to  any type. So if there is different pointer length. For example, <code>int *</code> 4-byte  long and function pointer 8-byte long (Just a example). So how the cast implement? <code>void *</code> has a fixed bit-mode, will it scale itself to cast into 4-byte <code>int*</code> and 8-byte function pointer? </p>