MESSAGE directive (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index

Syntax

{$MESSAGE HINT|WARN|ERROR|FATAL 'text string' }



Remarks

The Delphi message directive allows source code to emit hints, warnings, and errors just as the compiler does. This is similar to #emit or pragma warn in C and C++.

The message type (HINT, WARN, ERROR, or FATAL) is optional. If no message type is indicated, the default is HINT. The text string is required and must be enclosed in single quotes.

Examples:


{$MESSAGE 'Boo!'}                   emits a hint
{$Message Hint 'Feed the cats'}     emits a hint
{$messaGe Warn 'Looks like rain.'}  emits a warning
{$Message Error 'Not implemented'}  emits an error, continues compiling
{$Message Fatal 'Bang.  Yer dead.'} emits an error, terminates compiler