4.6 String breaks

The intrinsic value of each worthy character that appears inside a string denotation is itself. The string "/abc", therefore, contains a slash character followed by the three letters a, b and c.

Sometimes, however, it becomes necessary to represent some non-worthy character in a string denotation. In these cases, an escape convention has to be used to represent these extra string-items. It is up to the implementation to decide this convention, and the only requirement imposed by the Standard Hardware Representation on this regard is that the character used to introduce escapes, the escape character, shall be the apostrophe. This section documents the escape conventions implemented by the GNU compiler.

Two characters have special meaning inside string denotations: double quote (") and apostrophe ('). The first finishes the string denotation, and the second starts a string break, which is the Algol 68 term for what is known as an “escape sequence” in other programming languages. Two consecutive double-quote characters specify a single double-quote character.

The following string breaks are recognized by this compiler:

''

Apostrophe character '.

'n

Newline character.

'f

Form feed character.

'r

Carriage return (no line feed).

't

Tab.

'(list of character codes separated by commas)

The indicated characters, where each code has the form uhhhh or Uhhhhhhhh, where hhhh and hhhhhhhh are integers expressing the character code in hexadecimal. The list must contain at least one entry.

A string break can appear as the single string-item in a character denotation, subject to the following restrictions: