https://gcc.gnu.org/g:47561e459e7ea6ad2451310a3f9fee38fc08318d

commit r15-9539-g47561e459e7ea6ad2451310a3f9fee38fc08318d
Author: Sandra Loosemore <sloosem...@baylibre.com>
Date:   Wed Apr 16 22:16:16 2025 +0000

    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.

Diff:
---
 gcc/doc/extend.texi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 5bc2785f8025..0978c4c41b25 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

Reply via email to