what is FAR PASCAL?

FAR is obsolete; it was used in 16-bit code to indicate pointers that could address the entire address space, rather than just a 16-bit offset to the current segment.

PASCAL is a calling convention. As Wikipedia describes it:

The parameters are pushed on the stack in left-to-right order (opposite of cdecl), and the callee is responsible for balancing the stack before return.

This calling convention was common in the following 16 bit APIs: OS/2 1.x , Microsoft Windows 3.x, and Borland Delphi version 1.x.


Going by memory here,

FAR is a fall back to 16-bit days when heap memory was was segmented. NEAR data was limited in size and faster, FAR was allowed to be larger but more expensive.

To the best of my knowledge, in 32-bit land it's a macro that collapses to nothing.

PASCAL is a calling convention also used heavily in 16-bit days. It has since been replaced by stdcall.

Both are left in for backward compatibility.


FAR is a holdover from the 16-bit era, when we had near (16-bit) and far (32-bit) pointers.

PASCAL is a calling convention. I believe it's equivalent to stdcall nowadays.


  • PASCAL: It's related to a calling convention. The parameters are pushed on the stack in left-to-right order (opposite of cdecl), and the callee is responsible for balancing the stack before return.

    This calling convention was common in the following 16 bit APIs: OS/2 1.x and Microsoft Windows 3.x. There's some dispute over whether it was used by Borland Delphi 1.x

  • FAR: In a segmented architecture computer, a far pointer is a pointer which includes a segment selector, making it possible to point to addresses outside of the current segment.

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}

Tags:

C++

C

Syntax