我想知道为什么在某些源代码中会有 FAR 和 PASCAL 之类的宏。它们的含义和作用是什么?
最佳答案
PASCAL:它与 calling convention 有关.参数按从左到右的顺序入栈(与cdecl相反),被调用者负责在返回前平衡栈。
这种调用约定在以下 16 位 API 中很常见:OS/2 1.x 和 Microsoft Windows 3.x。 Borland Delphi 1.x 是否使用它存在一些争议
FAR:在分段架构计算机中,far pointer是一个包含段选择器的指针,可以指向当前段之外的地址。
For completeness, FAR and PASCAL are prepreocessor macros that, when compiled for 16-bit systems, expand to the keywords that were necessary to declare the calling convention and pointer size. On 32-bit systems, they generally expand to nothing (unless you have a weird default calling convention). The macros are retained for backward compatibility {hat/tip: comment from Adrian McCarthy}
关于c++ - 什么是远帕斯卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2774171/