FAQs about visual C ++ 64-bit migration

Source: Internet
Author: User
Tags truncated
FAQs about visual C ++ 64-bit migration Visual Studio 2012In other versions, this topic has not been rated.-comment on this topic.

When using Visual C ++ to create an application running in a 64-bit Windows operating system, pay attention to the following issues:

  • In 64-bit windows, int and long are 32-bit values. Do not assign pointers to programs planned to be compiled on the 64-bit Platform
    32-bit variable. On the 64-bit platform, the pointer is 64-bit. if the pointer is assigned to a 32-bit variable, the pointer value should be truncated.

  • In a 64-bit Windows operating system,Size_t,Time_tAndPtrdiff_tIs a 64-bit value.

  • In the 32-bit Windows Operating System Visual C ++ version earlier than visual C ++ 2005,Time_tIs a 32-bit value. By default,Time_tIt is a 64-bit integer. For more information, see time management.

    Pay attention to where the code uses the int value and uses itSize_tOrTime_tValue processing. Numbers may grow larger than 32 digits, and data may be truncated when transferred back to int storage.

% X (hexadecimal int format)PrintfModifiers do not work as expected in 64-bit windows. It only performs operations on the first 32-bit value of the value passed to it.

  • Windows 32-bit OS uses % i32x to display integers.

  • Windows 64-bit OS uses % i64x to display integers.

  • % P (The hexadecimal format of the pointer) works as expected in a 64-bit Windows operating system.

For more information, see:

  • Compiler Options

  • /Wp64

  • _ W64

  • Migration prompt

See

Programs with 64-bit configurations for other resources (Visual C ++)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.