diff options
author | Sandra Loosemore <sloosemore@baylibre.com> | 2025-04-16 22:16:16 +0000 |
---|---|---|
committer | Sandra Loosemore <sloosemore@baylibre.com> | 2025-04-16 22:21:39 +0000 |
commit | 47561e459e7ea6ad2451310a3f9fee38fc08318d (patch) | |
tree | 43693bc7ba5d874e9c60097aebe1a669bd06f33f | |
parent | 17c5ad25811a92c45083a0ad0b9c7e0d944c9521 (diff) | |
download | gcc-47561e459e7ea6ad2451310a3f9fee38fc08318d.zip gcc-47561e459e7ea6ad2451310a3f9fee38fc08318d.tar.gz gcc-47561e459e7ea6ad2451310a3f9fee38fc08318d.tar.bz2 |
Doc: Document raw string literals as GNU C extension [PR88382]
gcc/ChangeLog
PR c/88382
* doc/extend.texi (Syntax Extensions): Adjust menu.
(Raw String Literals): New section.
-rw-r--r-- | gcc/doc/extend.texi | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 5bc2785..0978c4c 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -12978,6 +12978,7 @@ C and/or C++ standards, while others remain specific to GNU C. * Binary constants:: Binary constants using the @samp{0b} prefix. * Dollar Signs:: Dollar sign is allowed in identifiers. * Character Escapes:: @samp{\e} stands for the character @key{ESC}. +* Raw String Literals:: C++ raw string literals are supported in C. * Alternate Keywords:: @code{__const__}, @code{__asm__}, etc., for header files. * Function Names:: Printable strings which are the name of the current function. @@ -13999,6 +14000,25 @@ machines, typically because the target assembler does not allow them. You can use the sequence @samp{\e} in a string or character constant to stand for the ASCII character @key{ESC}. +@node Raw String Literals +@subsection Raw String Literals +@cindex raw string literals +@cindex string literals, raw + +The C++11 standard added syntax for raw string literals prefixed +with @samp{R}. This syntax allows you to use an arbitrary delimiter +sequence instead of escaping special characters within the string. +For example, these string constants are all equivalent: + +@smallexample +const char *s1 = "\\"; +const char *s2 = R"(\)"; +const char *s3 = R"foo(\)foo"; +@end smallexample + +As an extension, GCC also accepts raw string literals in C with +@option{-std=gnu99} or later. + @node Alternate Keywords @subsection Alternate Keywords @cindex alternate keywords |