Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>*_PTR</code> types were added to the Windows API in order to support Win64's 64bit addressing.</p> <p>Because 32bit APIs typically passed pointers using data types like <code>DWORD</code>, it was necessary to create new types for 64 bit compatibility that could substitute for <code>DWORD</code> in 32bit applications, but were extended to 64bits when used in a 64bit applications.</p> <p>So, for example, application developers who want to write code that works as 32bit OR 64bit the windows 32bit API <code>SetWindowLong(HWND,int,LONG)</code> was changed to <code>SetWindowLongPtr(HWND,int,LONG_PTR)</code></p> <p>In a 32bit build, <code>SetWindowLongPtr</code> is simply a macro that resolves to <code>SetWindowLong</code>, and <code>LONG_PTR</code> is likewise a macro that resolves to <code>LONG</code>. In a 64bit build on the other hand, <code>SetWindowLongPtr</code> is an API that accepts a 64bit long as its 3rd parameter, and <code>ULONG_PTR</code> is typedef for <code>unsigned __int64</code>.</p> <p>By using these <code>_PTR</code> types, one codebase can compile for both Win32 and Win64 targets.</p> <hr> <p>When performing pointer arithmetic, these types should also be used in 32bit code that needs to be compatible with 64bit.</p> <p>so, if you need to access an array with more than 4billion elements, you would need to use an INT_PTR rather than an INT</p> <pre><code> CHAR* pHuge = new CHAR[0x200000000]; // allocate 8 billion bytes INT idx; INT_PTR idx2; pHuge[idx]; // can only access the 1st 4 billion elements. pHuge[idx2]; // can access all 64bits of potential array space. </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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