A string is a sequence of characters quoted with either double-quote mark (") or single-quote mark (') characters. The sequence must not include a newline character. When used in an expression, the numeric value of a string is the numeric value of the ASCII representation of its first character.
The suggested style is to use single quote mark characters for the ASCII value of a single character, and double quote mark characters for quoted-string operands such as used by pseudo-ops. An example of assembly code in the suggested style is:
add %g1,'a'-'A',%g1 ! g1 + ('a' - 'A') --> g1
The escape codes described in Table 2–1, derived from ANSI C, are recognized in strings.
Table 2–1|
Escape Code |
Description |
|---|---|
|
\a |
Alert |
|
\b |
Backspace |
|
\f |
Form feed |
|
\n |
Newline (line feed) |
|
\r |
Carriage return |
|
\t |
Horizontal tab |
|
\v |
Vertical tab |
|
\nnn |
Octal value nnn |
|
\xnn... |
Hexadecimal value nn... |