Quick start manual
4-18
Delphi Language Guide
Declarations and statements
Hinting Directives
The “hint” directives platform, deprecated, and library may be appended to any
declaration. These directives will produce warnings at compile time. Hint directives
can be applied to type declarations, variable declarations, class and structure
declarations, field declarations within classes or records, procedure, function and
method declarations, and unit declarations.
When a hint directive appears in a unit declaration, it means that the hint applies to
everything in the unit. For example, the Windows 3.1 style OleAuto.pas unit on
Windows is completely deprecated. Any reference to that unit or any symbol in that
unit will produce a deprecation message.
The platform hinting directive on a symbol or unit indicates that it may not exist or
that the implementation may vary considerably on different platforms. The library
hinting directive on a symbol or unit indicates that the code may not exist or the
implementation may vary considerably on different library architectures.
The platform and library directives do not specify which platform or library. If your
goal is writing platform-independent code, you do not need to know which platform
a symbol is specific to; it is sufficient that the symbol be marked as specific to some
platform to let you know it may cause problems for your goal of portability.
In the case of a procedure or function declaration, the hint directive should be
separated from the rest of the declaration with a semicolon. Examples:
procedure SomeOldRoutine; stdcall; deprecated;
var VersionNumber: Real library;
type AppError = class(Exception)
ƒ
end platform;
When source code is compiled in the {$HINTS ON} {$WARNINGS ON} state, each
reference to an identifier declared with one of these directives generates an
appropriate hint or warning. Use platform to mark items that are specific to a
particular operating environment (such as Windows or Linux), deprecated to
indicate that an item is obsolete or supported only for backward compatibility, and
library to flag dependencies on a particular library or component framework (such
as CLX).
Statements
Statements define algorithmic actions within a program. Simple statements—like
assignments and procedure calls—can combine to form loops, conditional
statements, and other structured statements.
Multiple statements within a block, and in the initialization or finalization section of
a unit, are separated by semicolons.