Previous: 2.2.3. Operators and Delimiters To the Table of Contents Next: 2.2.5. Constants
2.2.3. Operators and Delimiters Table of Contents 2.2.5. Constants

- 2.2.4. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
2.2.4. Program Comments


2.2.4. Program Comments


A good programmer knows that comments within a source file can be very helpful. Comments are delimited by “{“ and “}” or “(*” and “*)”. All comments are ignored by TMT Pascal during compilation. Comments cannot contain nested comments that use the same delimiters. Below are examples of traditional Pascal comments:
{ This is a comment }
(* Another comment *)
(* This comment is { nested } *)
{ Another (* nested *) comment }
(* An invalid (* comment *)
In addition to traditional comments, TMT Pascal supports C/C++ and Ada-style end-line comments. These begin with a double hyphen and span until the end of the line. For example:
/* This is C-style comment */
  Space := ' ';  -- initialize filler char
  FillChar(Ptr ($A0000), 64000, 0);  // clear VGA video memory
Remarks:
A comment that contains the dollar sign ($) immediately after opening {, (* or /* is a compiler directive. A mnemonic of the compiler command follows the $ character.

As of version 3.0, TMT Pascal does not support Ada-style comments by default. We are thinking about removing support for Ada-style comments in future and recommend you replace all Ada-style comments in your programs by traditional Pascal or C/C++ style comments. Use {$AC+} compiler switch, if you want to compile old sources with TMT Pascal 3.0 and higher (see $AC: Ada-Style Comments Switch.


Previous: 2.2.3. Operators and Delimiters To the Table of Contents Next: 2.2.5. Constants
2.2.3. Operators and Delimiters Table of Contents 2.2.5. Constants

- 2.2.4. -