RAD Studio (Common)
ContentsIndex
PreviousUpNext
Extended syntax (Delphi)
Type  
Switch  
Syntax  
{$X+} or {$X-} {$EXTENDEDSYNTAX ON} or {$EXTENDEDSYNTAX OFF}  
Default  
{$X+} {$EXTENDEDSYNTAX ON}  
Scope  
Global  

Remarks

Note: Note: The $X directive is provided for backward compatibility. You should not use the {$X-} mode when writing Delphi applications.
The $X directive enables or disables Delphi's extended syntax:
  • Function statements. In the {$X+} mode, function calls can be used as procedure calls; that is, the result of a function call can be discarded, rather than passed to another function or used in an operation or assignment. Generally, the computations performed by a function are represented through its result, so discarding the result makes little sense. Sometimes, however, a function is called because it performs a task such as setting the value of a global variable, without producing a useful result.
  • The Result variable. In the {$X+} mode, the predefined variable Result can be used within a function body to hold the function's return value.
  • Null-terminated strings. In the {$X+} mode, Delphi strings can be assigned to zero-based character arrays (array[0..X] of Char), which are compatible with PChar types.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!