liveBook · Manning

Execution character set

As explained in Modern C

The execution character set is the implementation-defined character set and numeric encoding used when a C program executes.

The execution character set supplies the implementation-defined characters and numeric encodings used while a C program executes. Numeric character escapes therefore depend on the platform and execution setting. section 8.4

A hexadecimal escape can consume the next character

The string "\xdeBruyn" is parsed differently from "\xde" "Bruyn": the hexadecimal escape consumes the B, producing one encoded character followed by "ruyn". Consecutive string literals avoid that ambiguity. TAKEAWAY: numerically encoded characters are not fully portable and should generally be avoided. section 8.4

Character conversion exposes further assumptions about the execution character set:

  • The hexatridecimal example assumes lowercase letters are contiguous and that uppercase and lowercase letters have a suitable relationship; those assumptions require testing or removal for portability. section 8.4

How Modern C covers it

How deep it goes
Defines implementation-dependent encoding and escape parsing, but stops short of specifying platform mappings.
Examples
Uses hexadecimal string escapes and a base-36 conversion function to expose encoding and character-order assumptions.
What you can do after
Evaluate/understand portability risks in encoded characters and avoid unverified ordering assumptions in conversion code.
How it connects
Connects character literals, string literals, hexadecimal escapes, locales, and character classification.

Also explained in

Compare how 2 books explain execution character set →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C. The section links point to the parts of the book it draws on.