Next: , Previous: IDE versus command line, Up: Borland Pascal



7.4 Comments

GPC supports comments surrounded by { } and (* *), just like BP does. According to the ISO 7185 and ISO 10206 standards, Pascal allows comments opened with (* and closed with }. Borland Pascal does not support such mixed comments, so you might have sources where passages containing comments are “commented out” using the other kind of comment delimiters. GPC's default behaviour is (like BP) not to allow mixed comments, so you don't need to worry about this. However, if you happen to like mixed comments, you can turn them on either by a command-line option, or by a compiler directive:

     --mixed-comments     {$mixed-comments}    (*$mixed-comments*)

GPC supports nested comments (e.g., { foo { bar } baz }), but they are disabled by default (compatible to BP which doesn't know nested comments at all). You can enable them with the option --nested-comments (or the equivalent compiler directive)

GPC also supports Delphi style comments starting with // and extending until the end of the line. This comment style is activated by default unless one of the --classic-pascal, --extended-pascal, --object-pascal or --borland-pascal dialect options is given. You can turn them on or off with the --[no-]delphi-comments option.