Skip to content

P2316R2 Consistent character literal encoding #4994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions source/preprocessor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -478,32 +478,12 @@
expression even though it is unsigned in translation phase
7\iref{lex.phases}.
\end{note}
This includes interpreting \grammarterm{character-literal}s, which may involve
converting escape sequences into execution character set members.
Whether the numeric value for these \grammarterm{character-literal}s
matches the value obtained when an identical \grammarterm{character-literal}
occurs in an expression
(other than within a
\tcode{\#if}
or
\tcode{\#elif}
directive)
is \impldef{numeric values of \grammarterm{character-literal}s in \tcode{\#if}
directives}.
This includes interpreting \grammarterm{character-literal}s
according to the rules in \ref{lex.ccon}.
\begin{note}
Thus, the constant expression in the following
\tcode{\#if}
directive and
\keyword{if} statement\iref{stmt.if}
is not guaranteed to evaluate to the same value in these two
contexts:
\begin{codeblock}
#if 'z' - 'a' == 25
if ('z' - 'a' == 25)
\end{codeblock}
The associated character encodings of literals are the same
in \tcode{\#if} and \tcode{\#elif} directives and in any expression.
\end{note}
Also, whether a single-character \grammarterm{character-literal} may have a negative
value is \impldef{negative value of \grammarterm{character-literal} in preprocessor}.
Each subexpression with type
\tcode{bool}
is subjected to integral promotion before processing continues.
Expand Down