2.16.1 ISO Syntax Support
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • The SWI-Prolog syntax
          • ISO Syntax Support
            • Processor Character Set
            • Nested comments
            • Character Escape Syntax
            • Syntax for non-decimal numbers
            • Using digit groups in large integers
            • Rational number syntax
            • NaN and Infinity floats and their syntax
            • Force only underscore to introduce a variable
            • Unicode Prolog source
            • Singleton variable checking
    • Packages

2.16.1.2 Nested comments

SWI-Prolog allows for nesting /* ... */ comments. Where the ISO standard accepts /* ... /* ... */ as a comment, SWI-Prolog will search for a terminating */. This is useful if some code with /* ... */ comment statements in it should be commented out. This modification also avoids unintended commenting in the example below, where the closing */ of the first comment has been forgotten.27Recent copies of GCC give a style warning if /* is encountered in a comment, which suggests that this problem has been recognised more widely.

/* comment

code

/* second comment */

code