-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Would a PR to switch to '#pragma once' be accepted? #858
Comments
I think it's hard to use this since: |
No compiler dependencies are permitted directly anywhere in .c or .h files. #pragma may not be used there. Compiler dependencies may be "indirectly" used if they are added to included/nuttx/compiler.h and a comon definition is provided for all tools. But even that use is discouraged. The OS should not, in general, depend on any property of any toolchain. So, please, do not consider adding #pragma to any source files. |
@xiaoxiang781216 just seeing a lot of complex header protection defines that someone has to put together (or script) that would go away. @patacongo I appreciate that, normally I wouldn't advocate for a pragma as they are compiler implementation specific. It's too bad that it hasn't made its way into the language standard proper yet. It's been supported by basically all compilers for a dozen years now. If, at some point, an exception would be made for this particular pragma, let me know! |
No worth it. There is no real benefit and a very, very big downside. We must not introduce ANY compiler dependencies in the source code. We have followed that rule for a dozen years and it will not change now.. Let's not consider this. |
Very bad idea. There is ABSOLUTELY not good reason to do this other than your personal preference which does not carry any weight in this. |
Would switch the #ifdef, #define, #endif entries to a single #pragma once at the top of each header file. #pragma once is widely supported at this point.
The text was updated successfully, but these errors were encountered: