sizeof(long) in 64-bit C++

前端 未结 6 1388
清歌不尽
清歌不尽 2020-12-05 18:21

I have downloaded MinGW-64, so I can now compile 64-bit programs for Windows 7, using g++ 4.7.0 (experimental). But the following line:

cout << sizeof(         


        
6条回答
  •  悲&欢浪女
    2020-12-05 18:42

    MinGW is designed to build a WIN32 application and WIN32 headers/libraries assumes the long(or LONG) type to be 32 bits wide even on a 64bit Windows. Microsoft decided that otherwise so much of the existing Windows source codes should be changed. For example, the following structure uses LONG types.

    typedef struct tagBITMAPINFOHEADER { 
    ...
      LONG biWidth; 
      LONG biHeight; 
    ...
    } BITMAPINFOHEADER
    

    ;

提交回复
热议问题