This article is a study note on the next situation of x64 after learning Chenhao's article, "Memory layout of C + + objects (top)". The link address of his article is: http://blog.csdn.net/haoel/article/details/3081328.
His sample code has the following fragments:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/88/58/wKiom1fweyigwHs2AAAMcXncBAA543.png-wh_500x0-wm_3 -wmp_4-s_1224092324.png "title=" 1.png "alt=" Wkiom1fweyigwhs2aaamcxncbaa543.png-wh_50 "/>
If you compile the x64 version of EXE in VS2015 Community Edition as debug, it crashes. After debugging, it is found that the address under x64 is represented by unsigned long long (if the test finds that the compilation background actually converts unsigned long long to unsigned __int64).
This code needs to be modified slightly to compile the normal x64 version of EXE:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/88/58/wKiom1fwfJ2j4m_mAAA5fvc_lAc034.png-wh_500x0-wm_3 -wmp_4-s_746272943.png "title=" 2.png "alt=" Wkiom1fwfj2j4m_maaa5fvc_lac034.png-wh_50 "/>
The results of the post-compilation run are the results of the original post program output:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/88/54/wKioL1fwfQnRFdQ5AAAWnOOnZio131.png-wh_500x0-wm_3 -wmp_4-s_1847209560.png "title=" 3.png "alt=" Wkiol1fwfqnrfdq5aaawnoonzio131.png-wh_50 "/>
From this learning debugging process, you can find that in x64 int, long two data types are used 4bytes storage. I always thought that under the x64 long type would occupy 8bytes, &GC cast to unsigned long**, the compiled program is always not normal. It is only normal to use unsigned long long**.
This article is from the "Hidden Forest Road" blog, please be sure to keep this source http://wxinhe.blog.51cto.com/6924993/1858369
Learning about the memory layout of C + + objects under win x64