C是否支持原始字符串文字? [英] Does C support raw string literals?

查看:54
本文介绍了C是否支持原始字符串文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++ 11添加了对原始字符串文字的支持,例如:

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

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

C有这样的事情吗?如果是这样,该标准是什么版本?C11?如果没有,有谁知道它是否正在计划中,是否有编译器支持它?

Does C have such a thing? If so, in what version of the standard? C11? If not, does anyone know if it is being planed and if any compilers support it?

推荐答案

C有这样的事情吗?如果是这样,该标准是什么版本?C11?

Does C have such a thing? If so, in what version of the standard? C11?

C(C90,C99,C11)不支持此功能或任何其他类似功能.

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

如果没有,有谁知道它是否正在计划中

If not, does anyone know if it is being planed

我不知道,但是通常C委员会强烈反对在C中包含新功能.

I have no idea, but usually there is a strong resistance of C committee to include new features in C.

以及是否有编译器支持它?

and if any compilers support it?

我刚刚对其进行了测试,并且最近的 gcc 版本都将其作为GNU扩展来支持(使用 -std = gnu99 -std = gnu11 ).

I just tested it and it is apparently supported with recent gcc versions as a GNU extension (compile with -std=gnu99 or -std=gnu11).

例如:

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

编译并给出预期的行为.

compiles and gives the expected behavior.

这篇关于C是否支持原始字符串文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆