-qcpluscmt

Category

Language element control

Pragma equivalent

None.

Purpose

Enables recognition of C++-style comments in C source files.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-cpluscmt---.   
>>- -q--+-nocpluscmt-+-----------------------------------------><

Defaults

  • -qcpluscmt when the xlc or c99 and related invocations are used, or when the stdc99 | extc99 language level is in effect.
  • -qnocpluscmt for all other invocation commands and language levels.

Predefined macros

__C99_CPLUSCMT is predefined to 1 when -qcpluscmt is in effect; otherwise, it is undefined.

Examples

To compile myprogram.c so that C++ comments are recognized as comments, enter:
xlc myprogram.c -qcpluscmt
Note that // comments are not part of C89. The result of the following valid C89 program will be incorrect:
main() {
  int i = 2;
  printf("%i\n", i //* 2 */
                 + 1);
}
The correct answer is 2 (2 divided by 1). When -qcpluscmt is in effect (as it is by default), the result is 3 (2 plus 1).

Related information