|
20 | 20 | \indextext{pointer literal|see{literal, pointer}}
|
21 | 21 | \indextext{user-defined literal|see{literal, user-defined}}
|
22 | 22 | \indextext{file, source|see{source file}}
|
| 23 | +\indextext{null character|see{character, null}} |
| 24 | +\indextext{null wide character|see{wide-character, null}} |
23 | 25 |
|
24 | 26 | \rSec1[lex.separate]{Separate translation}
|
25 | 27 |
|
26 | 28 | \pnum
|
27 | 29 | \indextext{conventions!lexical|(}%
|
28 | 30 | \indextext{compilation!separate|(}%
|
29 | 31 | The text of the program is kept in units called
|
30 |
| -\indextext{source file}\term{source files} in this International |
| 32 | +\defnx{source files}{source file} in this International |
31 | 33 | Standard. A source file together with all the headers~(\ref{headers})
|
32 | 34 | and source files included~(\ref{cpp.include}) via the preprocessing
|
33 | 35 | directive \tcode{\#include}, less any source lines skipped by any of the
|
|
56 | 58 | occur, although in practice different phases might be folded together.}
|
57 | 59 |
|
58 | 60 | \begin{enumerate}
|
59 |
| -\indextext{source file}% |
60 | 61 | \indextext{character!source file}%
|
61 | 62 | \indextext{character set!basic source}%
|
62 | 63 | \item Physical source file characters are mapped, in an
|
|
174 | 175 |
|
175 | 176 | \pnum
|
176 | 177 | \indextext{character set|(}%
|
177 |
| -\indextext{character set!basic source}% |
178 |
| -The \term{basic source character set} consists of 96 characters: the space character, |
| 178 | +The \defnx{basic source character set}{character set!basic source} consists of 96 characters: the space character, |
179 | 179 | the control characters representing horizontal tab, vertical tab, form feed, and
|
180 | 180 | new-line, plus the following 91 graphical characters:\footnote{The glyphs for
|
181 | 181 | the members of the basic source character set are intended to
|
|
229 | 229 | \grammarterm{universal-character-name}.}
|
230 | 230 |
|
231 | 231 | \pnum
|
232 |
| -The \term{basic execution character set} and the \term{basic |
233 |
| -execution wide-character set} shall each contain all the members of the |
| 232 | +The \defnx{basic execution character set}{character set!basic execution} and the |
| 233 | +\defnx{basic execution wide-character set}{wide-character set!basic execution} |
| 234 | +shall each contain all the members of the |
234 | 235 | basic source character set, plus control characters representing alert,
|
235 |
| -backspace, and carriage return, plus a \term{null character} |
236 |
| -(respectively, \term{null wide character}), whose value is 0. |
| 236 | +backspace, and carriage return, plus a \defnx{null character}{character!null} |
| 237 | +(respectively, \defnx{null wide character}{wide-character!null}), whose value is 0. |
237 | 238 | For each basic execution character set, the values of the
|
238 | 239 | members shall be non-negative and distinct from one another. In both the
|
239 | 240 | source and execution basic character sets, the value of each character
|
240 | 241 | after \tcode{0} in the above list of decimal digits shall be one greater
|
241 |
| -than the value of the previous. The \term{execution character set} |
242 |
| -and the \term{execution wide-character set} are |
| 242 | +than the value of the previous. The \defnx{execution character set}{character set!execution} |
| 243 | +and the \defnx{execution wide-character set}{wide-character set!execution} are |
243 | 244 | \impldef{execution character set and execution wide-character set}
|
244 | 245 | supersets of the
|
245 | 246 | basic execution character set and the basic execution wide-character
|
|
930 | 931 | \pnum
|
931 | 932 | \indextext{literal!\idxcode{unsigned}}%
|
932 | 933 | \indextext{literal!\idxcode{long}}%
|
933 |
| -\indextext{literal!integer}% |
934 |
| -\indextext{literal!binary}% |
935 |
| -\indextext{literal!octal}% |
936 |
| -\indextext{literal!decimal}% |
937 |
| -\indextext{literal!hexadecimal}% |
938 | 934 | \indextext{literal!base~of integer}%
|
939 |
| -An \term{integer literal} is a sequence of digits that has no period |
| 935 | +An \defnx{integer literal}{literal!integer} is a sequence of digits that has no period |
940 | 936 | or exponent part, with optional separating single quotes that are ignored
|
941 | 937 | when determining its value. An integer literal may have a prefix that specifies
|
942 | 938 | its base and a suffix that specifies its type. The lexically first digit
|
943 | 939 | of the sequence of digits is the most significant.
|
944 |
| -A \term{binary} integer literal (base two) begins with |
| 940 | +A \defnx{binary integer literal}{literal!binary} (base two) begins with |
945 | 941 | \tcode{0b} or \tcode{0B} and consists of a sequence of binary digits.
|
946 |
| -An \term{octal} integer |
947 |
| -literal (base eight) begins with the digit \tcode{0} and consists of a |
| 942 | +An \defnx{octal integer literal}{literal!octal} |
| 943 | +(base eight) begins with the digit \tcode{0} and consists of a |
948 | 944 | sequence of octal digits.\footnote{The digits \tcode{8} and \tcode{9} are not octal digits. }
|
949 |
| -A \term{decimal} |
950 |
| -integer literal (base ten) begins with a digit other than \tcode{0} and |
| 945 | +A \defnx{decimal integer literal}{literal!decimal} |
| 946 | +(base ten) begins with a digit other than \tcode{0} and |
951 | 947 | consists of a sequence of decimal digits.
|
952 |
| -A \term{hexadecimal} integer literal (base sixteen) begins with |
| 948 | +A \defnx{hexadecimal integer literal}{literal!hexadecimal} |
| 949 | +(base sixteen) begins with |
953 | 950 | \tcode{0x} or \tcode{0X} and consists of a sequence of hexadecimal
|
954 | 951 | digits, which include the decimal digits and the letters \tcode{a}
|
955 | 952 | through \tcode{f} and \tcode{A} through \tcode{F} with decimal values
|
|
1358 | 1355 | The integer and fraction parts both consist of
|
1359 | 1356 | a sequence of decimal (base ten) digits if there is no prefix, or
|
1360 | 1357 | hexadecimal (base sixteen) digits if the prefix is \tcode{0x} or \tcode{0X}.
|
1361 |
| -\indextext{literal!decimal floating}% |
1362 |
| -The literal is a \term{decimal floating literal} in the former case and |
1363 |
| -\indextext{literal!hexadecimal floating}% |
1364 |
| -a \term{hexadecimal floating literal} in the latter case. |
| 1358 | +The literal is a \defnx{decimal floating literal}{literal!decimal floating} in the former case and |
| 1359 | +a \defnx{hexadecimal floating literal}{literal!hexadecimal floating} in the latter case. |
1365 | 1360 | Optional separating single quotes in
|
1366 | 1361 | a \grammarterm{digit-sequence} or \grammarterm{hexadecimal-digit-sequence}
|
1367 | 1362 | are ignored when determining its value.
|
|
1558 | 1553 | also referred to as narrow
|
1559 | 1554 | string literals. A narrow string literal has type
|
1560 | 1555 | \indextext{literal!string!type~of}%
|
1561 |
| -``array of \term{n} \tcode{const char}'', where \term{n} is the size of |
| 1556 | +``array of \placeholder{n} \tcode{const char}'', where \placeholder{n} is the size of |
1562 | 1557 | the string as defined below, and has static storage
|
1563 | 1558 | duration~(\ref{basic.stc}).
|
1564 | 1559 |
|
|
1573 | 1568 | \indextext{prefix!\idxcode{u}}%
|
1574 | 1569 | such as \tcode{u"asdf"}, is
|
1575 | 1570 | a \tcode{char16_t} string literal. A \tcode{char16_t} string literal has
|
1576 |
| -type ``array of \term{n} \tcode{const char16_t}'', where \term{n} is the |
| 1571 | +type ``array of \placeholder{n} \tcode{const char16_t}'', where \placeholder{n} is the |
1577 | 1572 | size of the string as defined below; it
|
1578 | 1573 | is initialized with the given characters. A single \grammarterm{c-char} may
|
1579 | 1574 | produce more than one \tcode{char16_t} character in the form of
|
|
1585 | 1580 | \indextext{prefix!\idxcode{U}}%
|
1586 | 1581 | such as \tcode{U"asdf"}, is
|
1587 | 1582 | a \tcode{char32_t} string literal. A \tcode{char32_t} string literal has
|
1588 |
| -type ``array of \term{n} \tcode{const char32_t}'', where \term{n} is the |
| 1583 | +type ``array of \placeholder{n} \tcode{const char32_t}'', where \placeholder{n} is the |
1589 | 1584 | size of the string as defined below; it
|
1590 | 1585 | is initialized with the given characters.
|
1591 | 1586 |
|
|
1598 | 1593 | \indextext{\idxcode{wchar_t}}%
|
1599 | 1594 | \indextext{literal!string!wide}%
|
1600 | 1595 | \indextext{prefix!\idxcode{L}}%
|
1601 |
| -A wide string literal has type ``array of \term{n} \tcode{const |
1602 |
| -wchar_t}'', where \term{n} is the size of the string as defined below; it |
| 1596 | +A wide string literal has type ``array of \placeholder{n} \tcode{const |
| 1597 | +wchar_t}'', where \placeholder{n} is the size of the string as defined below; it |
1603 | 1598 | is initialized with the given characters.
|
1604 | 1599 |
|
1605 | 1600 | \pnum
|
|
1654 | 1649 | \pnum
|
1655 | 1650 | \indextext{\idxcode{0}|seealso{zero,~null}}%
|
1656 | 1651 | \indextext{\idxcode{0}!string terminator}%
|
1657 |
| -\indextext{\idxcode{0}!null~character}% |
| 1652 | +\indextext{\idxcode{0}!null~character|see {character, null}}% |
1658 | 1653 | After any necessary concatenation, in translation phase
|
1659 | 1654 | 7~(\ref{lex.phases}), \tcode{'\textbackslash 0'} is appended to every
|
1660 | 1655 | string literal so that programs that scan a string can find its end.
|
1661 | 1656 |
|
1662 | 1657 | \pnum
|
1663 |
| -\indextext{encoding!multibyte}% |
1664 | 1658 | Escape sequences and \grammarterm{universal-character-name}{s} in non-raw string literals
|
1665 | 1659 | have the same meaning as in character literals~(\ref{lex.ccon}), except that
|
1666 | 1660 | the single quote \tcode{'} is representable either by itself or by the escape sequence
|
|
1670 | 1664 | \tcode{char16_t} string literal may yield a surrogate pair.
|
1671 | 1665 | \indextext{string!\idxcode{sizeof}}%
|
1672 | 1666 | In a narrow string literal, a \grammarterm{universal-character-name} may map to more
|
1673 |
| -than one \tcode{char} element due to \term{multibyte encoding}. The |
| 1667 | +than one \tcode{char} element due to \defnx{multibyte encoding}{encoding!multibyte}. The |
1674 | 1668 | size of a \tcode{char32_t} or wide string literal is the total number of
|
1675 | 1669 | escape sequences, \grammarterm{universal-character-name}{s}, and other characters, plus
|
1676 | 1670 | one for the terminating \tcode{U'\textbackslash 0'} or
|
|
1786 | 1780 | \pnum
|
1787 | 1781 | A \grammarterm{user-defined-literal} is treated as a call to a literal operator or
|
1788 | 1782 | literal operator template~(\ref{over.literal}). To determine the form of this call for a
|
1789 |
| -given \grammarterm{user-defined-literal} \term{L} with \grammarterm{ud-suffix} \term{X}, |
1790 |
| -the \grammarterm{literal-operator-id} whose literal suffix identifier is \term{X} is |
1791 |
| -looked up in the context of \term{L} using the rules for unqualified name |
1792 |
| -lookup~(\ref{basic.lookup.unqual}). Let \term{S} be the set of declarations found by |
1793 |
| -this lookup. \term{S} shall not be empty. |
| 1783 | +given \grammarterm{user-defined-literal} \placeholder{L} with \grammarterm{ud-suffix} \placeholder{X}, |
| 1784 | +the \grammarterm{literal-operator-id} whose literal suffix identifier is \placeholder{X} is |
| 1785 | +looked up in the context of \placeholder{L} using the rules for unqualified name |
| 1786 | +lookup~(\ref{basic.lookup.unqual}). Let \placeholder{S} be the set of declarations found by |
| 1787 | +this lookup. \placeholder{S} shall not be empty. |
1794 | 1788 |
|
1795 | 1789 | \pnum
|
1796 |
| -If \term{L} is a \grammarterm{user-defined-integer-literal}, let \term{n} be the literal |
1797 |
| -without its \grammarterm{ud-suffix}. If \term{S} contains a literal operator with |
1798 |
| -parameter type \tcode{unsigned long long}, the literal \term{L} is treated as a call of |
| 1790 | +If \placeholder{L} is a \grammarterm{user-defined-integer-literal}, let \placeholder{n} be the literal |
| 1791 | +without its \grammarterm{ud-suffix}. If \placeholder{S} contains a literal operator with |
| 1792 | +parameter type \tcode{unsigned long long}, the literal \placeholder{L} is treated as a call of |
1799 | 1793 | the form
|
1800 | 1794 |
|
1801 | 1795 | \begin{codeblock}
|
1802 |
| -operator "" @\term{X}@(@\term{n}@ULL) |
| 1796 | +operator "" @\placeholder{X}@(@\placeholder{n}@ULL) |
1803 | 1797 | \end{codeblock}
|
1804 | 1798 |
|
1805 |
| -Otherwise, \term{S} shall contain a raw literal operator or a literal operator |
1806 |
| -template~(\ref{over.literal}) but not both. If \term{S} contains a raw literal operator, |
1807 |
| -the literal \term{L} is treated as a call of the form |
| 1799 | +Otherwise, \placeholder{S} shall contain a raw literal operator or a literal operator |
| 1800 | +template~(\ref{over.literal}) but not both. If \placeholder{S} contains a raw literal operator, |
| 1801 | +the literal \placeholder{L} is treated as a call of the form |
1808 | 1802 |
|
1809 | 1803 | \begin{codeblock}
|
1810 |
| -operator "" @\term{X}@(@"\term{n}{"}@) |
| 1804 | +operator "" @\placeholder{X}@(@"\placeholder{n}{"}@) |
1811 | 1805 | \end{codeblock}
|
1812 | 1806 |
|
1813 |
| -Otherwise (\term{S} contains a literal operator template), \term{L} is treated as a call |
| 1807 | +Otherwise (\placeholder{S} contains a literal operator template), \placeholder{L} is treated as a call |
1814 | 1808 | of the form
|
1815 | 1809 |
|
1816 | 1810 |
|
1817 | 1811 | \begin{codeblock}
|
1818 |
| -operator "" @\term{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>() |
| 1812 | +operator "" @\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>() |
1819 | 1813 | \end{codeblock}
|
1820 | 1814 |
|
1821 |
| -where \term{n} is the source character sequence $c_1c_2...c_k$. \begin{note} The sequence |
| 1815 | +where \placeholder{n} is the source character sequence $c_1c_2...c_k$. \begin{note} The sequence |
1822 | 1816 | $c_1c_2...c_k$ can only contain characters from the basic source character set.
|
1823 | 1817 | \end{note}
|
1824 | 1818 |
|
1825 | 1819 | \pnum
|
1826 |
| -If \term{L} is a \grammarterm{user-defined-floating-literal}, let \term{f} be the |
1827 |
| -literal without its \grammarterm{ud-suffix}. If \term{S} contains a literal operator |
1828 |
| -with parameter type \tcode{long double}, the literal \term{L} is treated as a call of |
| 1820 | +If \placeholder{L} is a \grammarterm{user-defined-floating-literal}, let \placeholder{f} be the |
| 1821 | +literal without its \grammarterm{ud-suffix}. If \placeholder{S} contains a literal operator |
| 1822 | +with parameter type \tcode{long double}, the literal \placeholder{L} is treated as a call of |
1829 | 1823 | the form
|
1830 | 1824 |
|
1831 | 1825 | \begin{codeblock}
|
1832 |
| -operator "" @\term{X}@(@\term{f}@L) |
| 1826 | +operator "" @\placeholder{X}@(@\placeholder{f}@L) |
1833 | 1827 | \end{codeblock}
|
1834 | 1828 |
|
1835 |
| -Otherwise, \term{S} shall contain a raw literal operator or a literal operator |
1836 |
| -template~(\ref{over.literal}) but not both. If \term{S} contains a raw literal operator, |
1837 |
| -the \term{literal} \term{L} is treated as a call of the form |
| 1829 | +Otherwise, \placeholder{S} shall contain a raw literal operator or a literal operator |
| 1830 | +template~(\ref{over.literal}) but not both. If \placeholder{S} contains a raw literal operator, |
| 1831 | +the \grammarterm{literal} \placeholder{L} is treated as a call of the form |
1838 | 1832 |
|
1839 | 1833 | \begin{codeblock}
|
1840 |
| -operator "" @\term{X}@(@"\term{f}{"}@) |
| 1834 | +operator "" @\placeholder{X}@(@"\placeholder{f}{"}@) |
1841 | 1835 | \end{codeblock}
|
1842 | 1836 |
|
1843 |
| -Otherwise (\term{S} contains a literal operator template), \term{L} is treated as a call |
| 1837 | +Otherwise (\placeholder{S} contains a literal operator template), \placeholder{L} is treated as a call |
1844 | 1838 | of the form
|
1845 | 1839 |
|
1846 | 1840 | \begin{codeblock}
|
1847 |
| -operator "" @\term{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>() |
| 1841 | +operator "" @\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>() |
1848 | 1842 | \end{codeblock}
|
1849 | 1843 |
|
1850 |
| -where \term{f} is the source character sequence $c_1c_2...c_k$. \begin{note} The sequence |
| 1844 | +where \placeholder{f} is the source character sequence $c_1c_2...c_k$. \begin{note} The sequence |
1851 | 1845 | $c_1c_2...c_k$ can only contain characters from the basic source character set.
|
1852 | 1846 | \end{note}
|
1853 | 1847 |
|
1854 | 1848 | \pnum
|
1855 |
| -If \term{L} is a \grammarterm{user-defined-string-literal}, let \term{str} be the |
1856 |
| -literal without its \grammarterm{ud-suffix} and let \term{len} be |
| 1849 | +If \placeholder{L} is a \grammarterm{user-defined-string-literal}, let \placeholder{str} be the |
| 1850 | +literal without its \grammarterm{ud-suffix} and let \placeholder{len} be |
1857 | 1851 | the number of
|
1858 |
| -code units in \term{str} (i.e., its length excluding the terminating |
| 1852 | +code units in \placeholder{str} (i.e., its length excluding the terminating |
1859 | 1853 | null character).
|
1860 |
| - The literal \term{L} is treated as a call of the form |
| 1854 | + The literal \placeholder{L} is treated as a call of the form |
1861 | 1855 |
|
1862 | 1856 | \begin{codeblock}
|
1863 |
| -operator "" @\term{X}@(@\term{str}{}@, @\term{len}{}@) |
| 1857 | +operator "" @\placeholder{X}@(@\placeholder{str}{}@, @\placeholder{len}{}@) |
1864 | 1858 | \end{codeblock}
|
1865 | 1859 |
|
1866 | 1860 | \pnum
|
1867 |
| -If \term{L} is a \grammarterm{user-defined-character-literal}, let \term{ch} be the |
| 1861 | +If \placeholder{L} is a \grammarterm{user-defined-character-literal}, let \placeholder{ch} be the |
1868 | 1862 | literal without its \grammarterm{ud-suffix}.
|
1869 |
| -\term{S} shall contain a literal operator~(\ref{over.literal}) whose only parameter has |
1870 |
| -the type of \term{ch} and the |
1871 |
| -literal \term{L} is treated as a call |
| 1863 | +\placeholder{S} shall contain a literal operator~(\ref{over.literal}) whose only parameter has |
| 1864 | +the type of \placeholder{ch} and the |
| 1865 | +literal \placeholder{L} is treated as a call |
1872 | 1866 | of the form
|
1873 | 1867 |
|
1874 | 1868 | \begin{codeblock}
|
1875 |
| -operator "" @\term{X}@(@\term{ch}{}@) |
| 1869 | +operator "" @\placeholder{X}@(@\placeholder{ch}{}@) |
1876 | 1870 | \end{codeblock}
|
1877 | 1871 |
|
1878 | 1872 | \pnum
|
|
0 commit comments