Skip to content

Pascal language behavior

Nexus Pascal accepts a supported Pascal subset. This reference describes its current text defaults and deliberate differences; it does not promise support for every upstream mode or binary format.

Compiler-Wide Default Text Types

One compiler-invocation choice controls the default text types throughout the source being compiled. The default is ANSI: unqualified String, Char, and PChar mean AnsiString, AnsiChar, and PAnsiChar. -MUNICODESTRINGS selects UnicodeString, WideChar, and PWideChar instead. -MANSISTRINGS explicitly selects the ANSI default.

Source-level mode directives cannot change this choice for an individual unit or include file. $H+ and $H- are accepted but have no effect. The -Sh command-line switch is likewise accepted but has no effect. The effective long-string state is always on, so $IFOPT H+ is true and $IFOPT H- is false. Conflicting source-level requests to select a different default text family are errors rather than silent overrides.

ShortString and String[n] remain explicit fixed-length string types. AnsiString, UnicodeString, AnsiChar, WideChar, PAnsiChar, and PWideChar also retain their explicit meanings regardless of the default. The choice does not specify an AnsiString code page or change the encoding required by an operating-system or JNI interface.

The $G switch

An active {$G+} or {$G-} is an illegal compiler directive. A processed conditional query of their state, {$IFOPT G+} or {$IFOPT G-}, is also illegal. There is no $G state or target-specific exception. MacPas mode's corresponding {$IFC OPTION(G)} query is illegal as well.

Floating-Point Emulation Directives

{$E+} and {$E-} are handled as unknown directives, like {$NONSENSEHDKJHKS}. {$IFOPT E+} and {$IFOPT E-} query an unknown switch and therefore select no branch, as with an unknown IFOPT name. {$FLOATINGPOINTEMULATION ...} is likewise an unknown directive. There is no floating-point emulation switch state. Use only the retained target FPU selections; NONE is not supported.

Kylix and Turbo Pascal compatibility options

Nexus Pascal does not support -Sk, -Mtp, -So, or -Ss, or the {$MODE TP} source directive. The command-line options are rejected as unknown options. {$MODE TP} follows the ordinary unknown-mode path: it emits an illegal-switch warning and leaves the current mode unchanged. No Kylix compatibility unit is automatically loaded, and object constructors and destructors have no special Init/Done name restriction.

Near/far procedure directives

{$F+}, {$F-}, and {$FARCALLS ...} follow the ordinary unknown-directive path. Pascal far and near procedure and procedure-variable directives are not accepted. The formerly ignored far pointer modifier on x86-64 and non-x86 targets is not accepted.

This rule does not remove the distinct i386 pointer modifiers: far selects an FS-segment pointer there, and near can explicitly select a segment register on x86. It also does not remove far/near operand qualifiers from x86 inline assembly, where they describe control-transfer instruction forms. Windows API identifiers such as FARPROC are unaffected.

$N and -a5 legacy options

{$N+} and {$N-} follow the ordinary unknown-directive path. The -a5 command-line option and its boolean-off form are rejected as unknown options. The compiler automatically requests Big Obj COFF output when a Windows target has enough sections to require it; that decision is no longer user-overridable to support pre-2.25 GNU binutils.

C-Style Assignment Operators Enabled by Default

C-style assignment operators +=, -=, *=, and /= are enabled by default. Programs and units do not need -Sc or {$COPERATORS ON} to use them.

Explicit controls retain their existing behavior: -Sc- and {$COPERATORS OFF} disable these operators; -Sc and {$COPERATORS ON} enable them. A source directive controls its own module and can override the initial command-line setting.

MMX Array Arithmetic

{$MMX} and {$SATURATION}, including their ON/OFF and +/- forms, are retired. They produce the normal illegal-directive warning; -Sew makes it a compilation failure. Built-in arithmetic on the small arrays formerly recognized by SUPPORT_MMX is removed. Use ordinary Pascal operations, an explicitly declared operator overload, or maintained SIMD code instead.

This does not change the supported target matrix. Inline-assembler MMX/SSE instructions, the separate i386 MMX unit and the RTL's MMX copy fallback remain.

the no-floating-point configuration

Supported Nexus Pascal targets provide floating-point support. NONE is no longer a selectable FPU type. -CfNONE and {$FPUTYPE NONE} are invalid; an empty FPU selection is invalid too. Other FPU selections retain their existing meanings.

Extended Pascal mode

Extended Pascal is no longer a compiler language mode. The former -Mextendedpascal selection receives the normal illegal-parameter diagnostic. {$mode extendedpascal} receives the same warning as an arbitrary unknown mode; -Sew promotes that warning to an error. No special retired-mode handler is retained. The compiler no longer predefines FPC_EXTENDEDPASCAL.