Note that there are some explanatory texts on larger screens.

plurals
  1. POUnderstanding the Justification for different Pointer Types
    primarykey
    data
    text
    <p>As a consious decision to create seperate model for pointer and non pointer data types Microsoft came up with a set of Data Types, which was stronly suggested to use them rather than POD like <code>int</code>, <code>__int64</code>, <code>long</code> (both <code>signed</code> and <code>unsigned</code> version).</p> <p>The Current Model Microsoft Follows is <code>IL32P64</code> which forced all the C Type cast of pointers to Integer Types vulnurable to pointer truncation. This forced them to come up with _PTR Types. For Each of the valid Integer Types (signed unsiged) like <code>long</code>, <code>int</code> or non POD Types like <code>DWORD</code>, they came up with the equivalent notation <code>DWORD_PTR</code>, <code>INT_PTR</code>.</p> <p>If we resolve the chain of typedefs, all these types boils down to the following defination</p> <pre><code>#if defined(_WIN64) typedef unsigned __int64 ULONG_PTR; #else typedef unsigned long ULONG_PTR; #endif #if defined(_WIN64) typedef unsigned __int64 LONG_PTR; #else typedef unsigned long LONG_PTR; #endif </code></pre> <p>What I would like to know, the reason to create different type defs for each Integer Types and non-POD equivalent rather than creating a single type to be used by all (say just one <code>INT_PTR</code> and <code>UINT_PTR</code>)</p> <p><strong>So Why do I want to know?</strong></p> <p>If you are always in MS Platform, its seldom a problem as to what MS Comes up with. Problem happens if your code is poly-platform. You have to define the equivalent types for *nix to make your code portable. </p> <p>I was planning to create only two Pointer Types say <code>XI64_PTR</code> and <code>XU64_PTR</code> with an equivalent defination and use it irrespective of what the previous types were.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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