What is the point of defining a calling convention?

后端 未结 5 1494
醉话见心
醉话见心 2021-01-24 06:20

For example:

int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show )

WINAPI is a a define that looks li

5条回答
  •  伪装坚强ぢ
    2021-01-24 06:59

    This was originally done during the switchover from 16-bit to 32-bit code. In the 16-bit version of it was:

    #define WINAPI __pascal
    

    WINAPI let you compile for either without modifying the source code. Of course, 16-bit Windows is no longer a factor (at least for most people), but it's still not worth changing all the source code to use __stdcall directly (especially since it could change again someday).

提交回复
热议问题