Name

$ExtendedSyntax Compiler Directive

Syntax

{$X+}                // default
{$ExtendedSyntax On} // default
{$X-}
{$ExtendedSyntax Off}

Scope

Local

Description

If $ExtendedSyntax is enabled, the compiler extends the syntax of standard Pascal in a few ways:

  • The value returned from a function call does not have to be assigned to a variable. Sometimes functions return a result, but the result is not important. Delphi’s extended syntax lets you call the function as though it were a procedure and ignore the function’s result.

  • Functions can assign a return value to the implicit Result variable.

  • An array of Char whose index is an integer type with a zero origin can be treated as a string. The string must be #0 terminated. You can also use such an array in any context that calls for a PChar type, and the compiler automatically passes the address of the first element of the array.

Delphi does not have any compiler directives for most of its other extensions to standard Pascal, but see the $BoolEval compiler directive for an exception.

See Also

$BoolEval Compiler Directive, Function Keyword, PChar Type

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.