Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Can I use 32-bit pointers in a 64-bit a…

Can I use 32-bit pointers in a 64-bit application?

Apr 05 2013
Author:

At present, the Microsoft Visual C++ and GCC compilers do not allow you to use 32-bit pointers in 64-bit software created for processors based on x86-64 architecture. You can use 64-bit registers and instruction sets together with 32-bit pointers in 32-bit programs on some other platforms (for instance, PowerPC).

The simplest way to circumvent the impossibility of using 32-bit pointers is to store data in global arrays using 32-bit types to index them. The drawback of this method is the impossibility of dynamic memory allocation for such structures durring runtime.

Another way is to encode 64-bit pointers into 32 bits. This article thoroughly describes the operation principles of the 'sptr' function intended for data alignment and specifics and restrictions of its use. The article contains samples illustrating mechanisms of encoding 64-bit pointers into 32-bit ones.

References

Popular related articles


Comments (0)

Next comments next comments
close comment form
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam