IT lexicon › Programming › Pascal calling convention

Pascal calling convention

Programming På svenska → Updated: 2026-11-07

Arguments pushed left to right, callee cleans up the stack — the convention that held Win16 and the classic Mac OS together.

The ordering comes from Pascal compilers, which evaluate arguments in the order they are written and push them the same way. Pascal had no variadic functions, so the callee always knew exactly how much was on the stack and could tidy it with a single ret N. That made every call site a few bytes shorter, which mattered when a whole program had to fit in 640 KB.

Windows 3.x exported its entire API this way, with FAR PASCAL in front of every function, and OS/2 1.x did the same. Apple's Toolbox on the 68k Mac also used Pascal ordering, since its interfaces were designed around Pascal. With Win32, Microsoft switched to stdcall, which kept callee cleanup but flipped the argument order to match C. The __pascal keyword was later dropped from MSVC, and what remains of the convention lives mostly in macros whose names nobody can quite explain anymore.

← Back to the lexicon