From 33b408e34a5fb47c5d107d759e13e7a6a20a1217 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Sun, 3 Oct 2021 21:50:36 +0200 Subject: [PATCH] P2316R2 Consistent character literal encoding --- source/preprocessor.tex | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/source/preprocessor.tex b/source/preprocessor.tex index a50ec234ba..6e9bea8816 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -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.