Name

$Hints Compiler Directive

Syntax

{$Hints On} // default
{$Hints Off}

Scope

Local, applies to entire subroutine

Description

The $Hints compiler directive enables or disables compiler hints. The compiler issues hints for code that seems suspect or likely to be an error. For example, the compiler issues a hint if a class has an unused private method. You might have written the method knowing that it is not currently used, but planning to use it in a future version. You can suppress the hint with the $Hints directive.

Tips and Tricks

Do not disable compiler hints globally in a file or project. The compiler hints are useful and can warn you about numerous common errors. Disable hints only when you know it is safe, and then disable them only for the subroutine in question.

Example

type
  TExample = class
  private
  {$Hints off}  { I know it's not used now, but I will use it later. }
    procedure Unused;
  {$Hints on}
    ...
  end;

See Also

$Warnings Compiler Directive

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.