aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/cpp.texi
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2002-05-05 23:45:06 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-05-05 23:45:06 +0000
commit95ff5d3fad7df3df18c91b3c834d983c52b62423 (patch)
tree27ed18362e6bd785c6d3ea6203ba7a5e06584f42 /gcc/doc/cpp.texi
parent49f8e94b6b09740703b9410dbd6efc2bd14a19e6 (diff)
downloadgcc-95ff5d3fad7df3df18c91b3c834d983c52b62423.zip
gcc-95ff5d3fad7df3df18c91b3c834d983c52b62423.tar.gz
gcc-95ff5d3fad7df3df18c91b3c834d983c52b62423.tar.bz2
cpp.texi: Update multichar charconst docs.
doc: * cpp.texi: Update multichar charconst docs. testsuite: * gcc.dg/cpp/charconst-3.c: New test. From-SVN: r53202
Diffstat (limited to 'gcc/doc/cpp.texi')
-rw-r--r--gcc/doc/cpp.texi24
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 260efdc..7ba498d 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -3508,17 +3508,25 @@ same column as it did in the original source file.
@item The numeric value of character constants in preprocessor expressions.
-The preprocessor and compiler interpret character constants in the same
-way; escape sequences such as @samp{\a} are given the values they would
-have on the target machine.
+The preprocessor and compiler interpret character constants in the
+same way; i.e.@: escape sequences such as @samp{\a} are given the
+values they would have on the target machine.
Multi-character character constants are interpreted a character at a
time, shifting the previous result left by the number of bits per
-character on the host, and adding the new character. For example, 'ab'
-on an 8-bit host would be interpreted as @w{'a' * 256 + 'b'}. If there
-are more characters in the constant than can fit in the widest native
-integer type on the host, usually a @code{long}, the excess characters
-are ignored and a diagnostic is given.
+target character and adding the sign-extended value of the new
+character. They have type @code{int}, and are treated as signed
+regardless of whether single characters are signed or not. If there
+are more characters in the constant than would fit in the target
+@code{int}, a diagnostic is given, and the excess leading characters
+are ignored. This methodology is not fully compatible with versions
+3.1 and earlier of GCC, which used a confusing and inconsistent
+valuation technique.
+
+For example, 'ab' for a target with an 8-bit @code{char} would be
+interpreted as @w{'a' * 256 + 'b'}, and 'a\234' as @w{'a' * 256 +
+'\234'}. GCC 3.1 and earlier would give a different value for the
+latter example, probably @w{'a' * 256 + (unsigned char) '\234'}.
@item Source file inclusion.