1.3.40 $X or $EXTENDEDSYNTAX : Extended syntax

Extended syntax allows you to drop the result of a function and perform pointer arithmetic. This means that you can use a function call as if it were a procedure. By default this feature is on. You can switch it off using the {$X-} or {$EXTENDEDSYNTAX OFF}directive.

The following, for instance, will not compile:

function Func (var Arg : sometype) : longint;  
...          { declaration of Func }  
Func (A);

The reason this construct is supported is that you may wish to call a function for certain side-effects it has, but you don’t need the function result. In this case you don’t need to assign the function result, saving you an extra variable.

Similarly, the pointer math wil be disabled:

  x,p : pointer;  

will result in an error for both lines:

ex.pp(13,14) Error: Operation "+" not supported for types "PByte" and "ShortInt"  
ex.pp(15,16) Error: Operation "+" not supported for types "PDouble" and "ShortInt"

The command line compiler switch -Sa1 has the same effect as the {$X+} directive.

By default, extended syntax is assumed.