Versions Compared

Key

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

...

In this example, the function f() is passed a const char pointer. It then typecasts the const specification away, and proceeds to modify the contents.

...

In this compliant solution the function f() is passed a non-const char pointer. The calling function must ensure that the null-terminated byte string passed to the function is not const by making a copy of the string or by other means.

...