Punctuation - cppreference.com
Namespaces
Variants

Punctuation

From cppreference.com
 
 
C++ language
General topics
Flow control
Conditional execution statements
if
Iteration statements (loops)
for
range-for (C++11)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications (until C++17*)
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
const/volatile
decltype (C++11)
auto (C++11)
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
explicit (C++11)
static

Special member functions
Templates
Miscellaneous
 
 

These are the punctuation symbols in C++. The meaning of each symbol is detailed in the linked pages.

Preprocessing operators

Preprocessing operators are recognized by preprocessors.

#

Alternative spelling is %:.

##

Alternative spelling is %:%:.

Single-character operators and punctuators

{ and }

Alternative spellings are <% and %> respectively.

(since C++11)
(since C++20)

[ and ]

Alternative spellings are <: and :> respectively.

(since C++11)
(since C++17)
(since C++26)

( and )

(since C++11)
(since C++11)
(since C++17)
(since C++20)
(since C++11)
  • In a handler, delimit the parameter declaration.
  • In a function-like macro definition, delimit the macro parameters.
  • In a function-like macro invocation, delimit the macro arguments or prevent commas from being interpreted as argument separators.
  • Part of a defined, __has_include(since C++17), __has_cpp_attribute(since C++20) preprocessing operator.
  • In a static_assert declaration, delimit the operands.
  • Delimit the operand of the following specifiers:
(since C++20)
  • In an attribute, delimit the attribute arguments.
(since C++11)
(since C++14)
(since C++17)
  • Part of __VA_OPT__ replacement in a variadic macro definition.
(since C++20)

;

  • Indicate the end of
(since C++20)

:

(since C++11)
(since C++17)
(since C++20)

?

.

(since C++20)

~

Alternative spelling is compl.

!

Alternative spelling is not.

(since C++23)

+

-

*

  • Part of *this in a lambda capture list, to capture the current object by copy.
(since C++17)

/

%

^

Alternative spelling is xor.

&

Alternative spelling is bitand.

(since C++11)

|

Alternative spelling is bitor.

=

(since C++11)
(since C++20)

<

(since C++20)
(since C++17)
(since C++20)

>

(since C++20)
(since C++17)
(since C++20)

,

(since C++11)
(since C++17)
(since C++23)
(since C++11)

Multi-character operators and punctuators

[: and :] (since C++26)

^^ (since C++26)

...

  • In the parameter list of a function declarator or lambda expression(since C++11) or user-defined deduction guide(since C++17), signify a variadic function.
  • In a handler, signify catch-all handler.
(since C++11)
(since C++26)

::

  • Scope resolution operator in
(since C++11)
(since C++17)

.*

->

(since C++11)
(since C++17)
(since C++20)

->*

+=

-=

*=

/=

%=

^=

Alternative spelling is xor_eq.

&=

Alternative spelling is and_eq.

|=

Alternative spelling is or_eq.

==

!=

Alternative spelling is not_eq.

<=

>=

<=>

(since C++20)

&&

Alternative spelling is and.

(since C++11)

||

Alternative spelling is or.

<<

>>

<<=

>>=

++

--

References

  • C++23 standard (ISO/IEC 14882:2024):
  • 5.12 Operators and punctuators [lex.operators]
  • C++20 standard (ISO/IEC 14882:2020):
  • 5.12 Operators and punctuators [lex.operators]
  • C++17 standard (ISO/IEC 14882:2017):
  • 5.12 Operators and punctuators [lex.operators]
  • C++14 standard (ISO/IEC 14882:2014):
  • 2.13 Operators and punctuators [lex.operators]
  • C++11 standard (ISO/IEC 14882:2011):
  • 2.13 Operators and punctuators [lex.operators]
  • C++03 standard (ISO/IEC 14882:2003):
  • 2.12 Operators and punctuators [lex.operators]
  • C++98 standard (ISO/IEC 14882:1998):
  • 2.12 Operators and punctuators [lex.operators]

See also