GCC adds C++ multiline raw string literals as a C extension
C++11 has raw string literals as mentioned at: https://stackoverflow.com/a/44337236/895245
However, GCC also adds them as a C extension, you just have to use -std=gnu99
instead of -std=c99
. E.g.:
main.c
#include <assert.h>
#include <string.h>
int main(void) {
assert(strcmp(R"(
a
b
)", "\na\nb\n") == 0);
}
Compile and run:
gcc -o main -pedantic -std=gnu99 -Wall -Wextra main.c
./main
This can be used for example to insert multiline inline assembly into C code: How to write multiline inline assembly code in GCC C++?
Now you just have to lay back, and wait for it to be standardized on C20XY.
C++ was asked at: C++ multiline string literal
Tested on Ubuntu 16.04, GCC 6.4.0, binutils 2.26.1.