Code Monkey home page Code Monkey logo

Comments (10)

ivanperez-keera avatar ivanperez-keera commented on June 28, 2024

That's a good point. I see no reason to make them public and I agree that it would be better to make functions static.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 28, 2024

@fdedden Did you have a chance to look into this? Do you think this can be done without negative impact?

from copilot.

fdedden avatar fdedden commented on June 28, 2024

Dear Simon, thank you for the suggestion. Yes, it is indeed better to have these functions defined as static. It forces the so called 'storage duration' to be as long as the execution of the program (which is what we want here). As you mentioned, adding static to global functions keeps the function private to the execution unit (similar to a file in this case) as well.

The addition of the keyword has already been implemented in January for the 3.18 release of Copilot (see 6779d03) to comply with the MISRA C coding standard. It should suffice for you to upgrade to at least the 3.18 release.

Please let me know if you have any more questions.

Reference to the C99 standard, section 6.2.2 and 6.2.4: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 28, 2024

The addition of the keyword has already been implemented in January for the 3.18

I think I only added it for variables, not functions, didn't I?

from copilot.

fdedden avatar fdedden commented on June 28, 2024

The addition of the keyword has already been implemented in January for the 3.18

I think I only added it for variables, not functions, didn't I?

No? The commit I mentioned (6779d03) adds static to the generator and accessor functions, and omits the step function (which is what we want).

The variables have been defined static since I wrote the first version of the C99 backend.

Let me also ping @simondlevy, since I forgot to do that in my initial reply.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 28, 2024

You're right. I completely forgot! 😮

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 28, 2024

@simondlevy have you been able to try with the latest version?

from copilot.

simondlevy avatar simondlevy commented on June 28, 2024

I bought a new computer recently and installed Copilot on it following the instructions as usual. When I tried the heater example, the compiled C header still did make the declarations static.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 28, 2024

But were functions static or not? That was the issue, wasn't it?

from copilot.

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.