Difference between revisions of "$IF"

From Lazarus wiki
Jump to navigationJump to search
m
(syntaxhighlight, other example)
Line 1: Line 1:
 
{{$IF}}
 
{{$IF}}
  
The $IF directive can be used in [[Conditional compilation|conditional compilation]].
+
The <code>$IF</code> directive can be used in [[Conditional compilation|conditional compilation]].
  
<code>
+
<syntaxhighlight>
{$IF CompilerVersion >= 20 }
+
// pointermath directive did not exist prior FPC 3.0.0
    if FHandle = INVALID_HANDLE_VALUE then
+
{$if FPC_VERSION > 2}
{$IFEND}  
+
// pointer arithmetics is bad. very bad
</code>
+
{$pointermath off}
 +
{$endif}
 +
</syntaxhighlight>
  
 
{{Directives, Defines and Conditionals}}
 
{{Directives, Defines and Conditionals}}

Revision as of 17:07, 20 January 2018

Deutsch (de) English (en) français (fr) русский (ru)

The $IF directive can be used in conditional compilation.

// pointermath directive did not exist prior FPC 3.0.0
{$if FPC_VERSION > 2}
	// pointer arithmetics is bad. very bad
	{$pointermath off}
{$endif}
Directives, definitions and conditionals definitions
global compiler directives • local compiler directives

Conditional Compiler Options • Conditional compilation • Macros and Conditionals • Platform defines
$IF