Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə49/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   45   46   47   48   49   50   51   52   ...   294
DelphiLanguageGuide

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.
30


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 .NET), 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.
The Delphi 2005 compiler also recognizes the hinting directive experimental. You can use this directive to designate
units which are in an unstable, development state. The compiler will emit a warning when it builds an application
that uses the unit.
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.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   45   46   47   48   49   50   51   52   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin