为什么 m4 使用两个不同的字符作为引号?
Why m4 uses two different characters for quotes?
几乎在每一种语言中引用字符串都很简单——你在字符串之前放一些东西,然后在字符串末尾放同样的东西(可能是镜像的),例如:
"string"
'string'
R"(string)"
m4 宏处理器不同,因为字符串是使用反引号和单引号引用的,如下所示:
`string'
我的问题是:这种方法是否有任何技术理由,或者它只是作者创造力的表达?
引用Wikipedia,与控制字符串宏展开有关:
Unlike most languages, strings in m4 are quoted using the backtick (`)
as the starting delimiter, and apostrophe (') as the ending delimiter.
The use of separate starting and ending delimiters allows for the
arbitrary nesting of quotation marks in strings, allowing a fine
degree of control of how and when macro expansion takes place in
different parts of a string.
几乎在每一种语言中引用字符串都很简单——你在字符串之前放一些东西,然后在字符串末尾放同样的东西(可能是镜像的),例如:
"string"
'string'
R"(string)"
m4 宏处理器不同,因为字符串是使用反引号和单引号引用的,如下所示:
`string'
我的问题是:这种方法是否有任何技术理由,或者它只是作者创造力的表达?
引用Wikipedia,与控制字符串宏展开有关:
Unlike most languages, strings in m4 are quoted using the backtick (`) as the starting delimiter, and apostrophe (') as the ending delimiter. The use of separate starting and ending delimiters allows for the arbitrary nesting of quotation marks in strings, allowing a fine degree of control of how and when macro expansion takes place in different parts of a string.