Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Noncompliant Code Example

Code Block
bcColorbgColor#ffcccc
char c = 'c';
char &const p = c;
p = 'p';
cout << c << endl;

...

If constant access is required, instead of using a const reference, one can use a const pointer:

Code Block
bcColorbgColor#ccccff
char c = 'c';
char *const p = c;
*p = 'p'; // causes compiler error
cout << c << endl;

...