Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C 头文件名不应被视为过时的 #34

Open
frederick-vs-ja opened this issue Dec 19, 2023 · 2 comments
Open

C 头文件名不应被视为过时的 #34

frederick-vs-ja opened this issue Dec 19, 2023 · 2 comments

Comments

@frederick-vs-ja
Copy link

问题来自提交 69bba35

C++ 标准中将 C 头文件设为弃用是历史错误,因为大部分 C 头文件并不是待移除的候选。 C++23 更正了这个问题,见 WG21 P2340R1

现在的推荐应该是

The intended use of these headers is for interoperability only. It is possible that C++ source files need to include one of these headers in order to be valid ISO C. Source files that are not intended to also be valid ISO C should not use any of the C headers.

这些头文件仅有意用于可互操作。 C++ 源文件有可能需要包含这些头文件之一以成为合法的 ISO C。无意同时作为合法的 C 的源文件不应该使用任何这些 C 头文件。

@Mq-b
Copy link
Contributor

Mq-b commented Dec 19, 2023

虽然但是,我觉得不使用 C 头文件名 是没问题的,这个兼容在我看来纯属是被迫。

@brotherbeer
Copy link
Collaborator

这个要求对应 MISRA C++ 2008 18-0-1,算是车规级标准的硬性要求吧,车载产品如果要过审还是得遵守的,现在我们依据的还是C++11,正在向 C++17 靠拢,这个问题先记下,感谢提醒~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants