Versions Compared

Key

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

...

Use plain char for character data for compatibility with standard string handling functions.

The only permissible In most cases, the only portable operators on plain char types are assignment and equality operators (=, ==, != ).  An exception is the translation to and from digits.  For example, if the char c is a digit, c - '0' is a value between 0 and 9.

Non-Compliant Code Example

...

Wiki Markup
Compiling at high warning levels in compliance with [MSC00-A. Compile cleanly at high warning levels] causes warnings to be issued when converting from {{unsigned char\[\]}} to {{const char const *}} when {{char}} is signed and from {{signed char\[\]}} to {{const char const *}} when char is defined to be unsigned.  Casts are required to eliminate these warnings, but excessive casts can make code difficult to read and hide legitimate warning messages.

Wiki Markup
If this C code were to compiled using a C+\+ compiler, conversions from {{unsigned char\[\]}} to {{const char const *}} and from {{signed char\[\]}} to {{const char const *}} would be be flagged as errors requiring casts.

...