Messages: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Messages
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Free Pascal allows the programmer to define normal messages, warning and error messages. These messages are displayed in the message window. | |
| 2 | + | ||
| 3 | + | These self-defined messages are intended to enable the programmer to better oversee and manage his code. | |
| 4 | + | ||
| 5 | + | The compiler treats these messages as if they were messages generated by the compiler. This means that if the compiler has been instructed not to issue warnings, then self-defined warnings will not be issued. | |
| 6 | + | ||
| 7 | + | In contrast, error messages are always displayed. The compiler stops when there are 50 error messages. If an error message occurs, no executable file is created. In the event of a fatal error, the compiler stops immediately. | |
| 8 | + | ||
| 9 | + | The syntax for **messages** looks like this: | |
| 10 | + | ||
| 11 | + | ``` pascal | |
| 12 | + | ||
| 13 | + | {$Message Message text} | |
| 14 | + | // or | |
| 15 | + | {$Info Message text} | |
| 16 | + | ``` | |
| 17 | + | ||
| 18 | + | The syntax for **notes** looks like this: | |
| 19 | + | ||
| 20 | + | ``` pascal | |
| 21 | + | {$Note Message text} | |
| 22 | + | ``` | |
| 23 | + | ||
| 24 | + | The syntax for **warnings** looks like this: | |
| 25 | + | ||
| 26 | + | ``` pascal | |
| 27 | + | ||
| 28 | + | {$Warning Warning Message text} | |
| 29 | + | ``` | |
| 30 | + | ||
| 31 | + | The syntax for **hints** looks like this: | |
| 32 | + | ||
| 33 | + | ``` pascal | |
| 34 | + | ||
| 35 | + | {$Hint Warning Message text} | |
| 36 | + | ``` | |
| 37 | + | ||
| 38 | + | The syntax for **error** messages looks like this: | |
| 39 | + | ||
| 40 | + | ``` pascal | |
| 41 | + | ||
| 42 | + | {$Error Error Message text} | |
| 43 | + | ``` | |
| 44 | + | ||
| 45 | + | The syntax for **fatal error** messages looks like this: | |
| 46 | + | ||
| 47 | + | ``` pascal | |
| 48 | + | {$Fatal Error Message text} | |
| 49 | + | // or | |
| 50 | + | {$Stop Error Message text} | |
| 51 | + | ``` | |
| 52 | + | ||
| 53 | + | Note: You cannot use **}** in a message because this is the terminating character of a message for the compiler. | |
| 54 | + | ||
| 55 | + | --- | |
| 56 | + | *From the Free Pascal wiki, page "Messages", as it stood on 2020-02-20 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
