Coder Social home page Coder Social logo

Comments (5)

xiaoxiang781216 avatar xiaoxiang781216 commented on August 29, 2024

I think it's hard to use this since:
1.NuttX need comatablie with C89 standard
2.#pragma once isn't defined in C standard
I also don't see the benefit to switch #ifndef/#define/#endif to #pragma once, do you have any particular reason?

from nuttx.

patacongo avatar patacongo commented on August 29, 2024

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.

from nuttx.

cmorganBE avatar cmorganBE commented on August 29, 2024

@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!

from nuttx.

patacongo avatar patacongo commented on August 29, 2024

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.

from nuttx.

patacongo avatar patacongo commented on August 29, 2024

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.

from nuttx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.