Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:34:43+00:00 2026-06-07T16:34:43+00:00

So I have this existing bit of code that compiles perfectly in Visual Studio

  • 0

So I have this existing bit of code that compiles perfectly in Visual Studio 2005, when the target platform is 32 bit. However, it does not work in 64 bit. I don’t understand why; in fact I have never seen a pointer being cast to a long before. Is it even correct C++?

#define REAL double
typedef REAL* point; 
point *ptary; //(so it's basically double** ptary?)
long arylen = (long) ptary[0]; 

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:34:45+00:00Added an answer on June 7, 2026 at 4:34 pm

    It appears to work on the 32 bit system because pointers and longs are both 32 bits wide. It fails to work on the 64 bit system, because pointers are 64 bits wide, but longs are (probably) still only 32 bits wide.

    You can easily check this by printing out sizeof(double*) and sizeof(long). My guess is that the output will be 8 and 4, respectively, on the 64 bit system.

    If you need an integer type that is capable of holding a pointer, use intptr_t from <stdint.h>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading existing code at work, I wondered how come this could work. I have
I have this bit of code. It is used to update the form after
I have an existing bit of code for sorting a list of objects. productsList.Sort(
I have a bit of PHP code that's baffling me for some reason. I
I have this code that works from an .as file if (loaderInfo.loader) loaderInfo.loader.dispatchEvent(new Event(pageFinish,
I have an existing C++ win32 console app. This application contains a main program
I have been following the answer of this question: How to update existing object
I have a servlet which takes us to an existing jsp, say home.jsp. This
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I am using Visual Studio 2008 to build my projects. I often take existing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.