Does C support source string literals?

C ++ 11 added support for raw string literals such as:

R"foo(A " weird \" string)foo" 

Does C have this? If so, in which version of the standard? C11? If not, does anyone know if it is planned, and can any compilers support it?

+7
c string escaping string-literals
source share
1 answer

Does C have this? If so, in which version of the standard? C11?

C (C90, C99, C11) does not support this function or any other similar function.

If not, does anyone know if it is planned

I have no idea, but usually there is strong resistance from Committee C to include new features in C.

and if any compilers support it?

I just tested it and apparently supported the latest versions of gcc as a GNU extension (compiled with -std=gnu99 or -std=gnu11 ).

For example:

 printf(R"(hello\nworld\n)"); 

compiles and gives the expected behavior.

+5
source share

All Articles