允许使用哪些令牌作为#include的参数? [英] What tokens are permitted as arguments to #include?

查看:45
本文介绍了允许使用哪些令牌作为#include的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

包含中的标准要求允许哪种令牌?例如,文件名中是否允许空格?

What sort of tokens are required to be allowed by the standard in includes? E.g., are spaces in file names allowed?

推荐答案

来自源文件包含

任何预处理标记(宏常量或表达式)为允许作为#include和__has_include的参数(自C ++ 17起)只要它们扩展为由&​​lt;括起来的字符序列即可.>或".

Any preprocessing tokens (macro constants or expressions) are permitted as arguments to #include and __has_include (since C++17) as long as they expand to a sequence of characters surrounded by < > or "".

然后在说明中

实现定义的方式搜索文件.目的该语法用于搜索不受以下内容控制的文件:实施.

Searches for the file in implementation-defined manner. The intent of this syntax is to search for the files that are not controlled by the implementation.

此外, c ++ 20最终工作草案 5.8标头名称[lex.header]

Furthermore, the c++20 final working draft 5.8 Header names [lex.header] and
ISO/IEC 9899:1999 6.4.7 Header names except newline, > and ".

header-name:
    < h-char-sequence >
    " q-char-sequence "
h-char-sequence :
    h-char
    h-char-sequence h-char
h-char:
    any member of the source character set except new-line and >
q-char-sequence :
    q-char
    q-char-sequence q-char
q-char:
    any member of the source character set except new-line and "

这篇关于允许使用哪些令牌作为#include的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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