The value of the uninitialized variable is 0 xcccccccc-858993460 hot

Source: Internet
Author: User
Pointer: 0 xcccccccc The debug version of VC automatically initializes Uninitialized pointers 0 xcccccccc, Instead of randomly removing it, it is because the purpose of the debug version is to facilitate debugging. Program If the initial values of the wild pointer are uncertain, different results may occur every time you debug the same program. For example, this program crashes and runs normally next time, but the result is incorrect ...... It is obviously very unfavorable for us to solve the bug.
The debug version initializes the data pair on the stack into 0xcc to allow programmers to discover errors earlier. That is to say, if the local variable is not initialized, it will be 0xcc In the debug version.

For debugging convenience, that is, its edit and continue feature, debug allocates 64 bytes for each function. When debuggingCodeWhen a small number of variables are added, the compiler can allocate the 64 bytes of space in the past, so that the program does not need to be re-compiled for re-debugging.

INT:-858993460 (hexadecimal oxcccccccc) (Binary 11001100110011001100110011001100) A. When an uninitialized value is assigned (at least the memory not initialized under VC), the default value is 0 xcccccccc ;, in the memory, it is saved as-858993460 by default, that is, the binary 11001100 11001100 11001100 11001100; The hexadecimal cccccc; and the Chinese character "hot" encoding is exactly 1100110011001100:
B. If the data type of the variable overflows due to your operation, the system will automatically change to-858993460 in the memory. Unsigned, unsigned long: 3435973836(Oxcccccccc) (11001100110011001100110011001100) Short:-13108(0 xcccc) (1100110011001100) CHAR:-52 '? 'Where-52 is (0xcc) (11001100) Double, long double:-9.2559631349317831e + 061 Bool: True

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.