MESSAGE directive (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Object Pascal Compiler Directives (List) Index




The Object Pascal 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.


{$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