C string append

眉间皱痕 提交于 2019-12-05 20:05:37

Yes, it is guaranteed.

Extract from http://en.wikipedia.org/wiki/C_syntax#String_literal_concatenation :

Adjacent string literals are concatenated at compile time; this allows long strings to be split over multiple lines, and also allows string literals resulting from C preprocessor defines and macros to be appended to strings at compile time

Yes. this concatenation is allowed in C, it is not undefined behavior.

Although I think it should produce "May GodBless You" (since there is no space in the quoted part)

The Standard says

5.1.1.2 Translation phases

6. Adjacent string literal tokens are concatenated.

So, the Solaris compiler was doing the right thing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!