Raw String Literals (Using the GNU Compiler Collection (GCC)) (original) (raw)

Next: Alternate Keywords, Previous: The Character ESC in Constants, Up: Other Extensions to C Syntax [Contents][Index]


6.12.20 Raw String Literals

The C++11 standard added syntax for raw string literals prefixed with ‘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:

const char *s1 = "\"; const char *s2 = R"()"; const char *s3 = R"foo()foo";

As an extension, GCC also accepts raw string literals in C with-std=gnu99 or later.