Comments (12)
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.
@fdedden Did you have a chance to look into this? Do you think this can be done without negative impact?
from copilot.
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.
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.
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.
You're right. I completely forgot! 😮
from copilot.
@simondlevy have you been able to try with the latest version?
from copilot.
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.
But were functions static or not? That was the issue, wasn't it?
from copilot.
@simondlevy Just to confirm: your issue has been solved, right?
from copilot.
Bump
from copilot.
@simondlevy The original problem should be solved, so I will close this issue now. If you still encounter problems, please do not hesitate to open a new issue.
from copilot.
Related Issues (20)
- `copilot-core`: record field `uTypeType` is unnecessary
- Release 3.18 HOT 6
- `copilot`: Extend range of versions `optparse-applicative` HOT 6
- `copilot-theorem`: Failure to compile with GHC 9.6.3 HOT 6
- Release 3.18.1 HOT 6
- `copilot-theorem`: `kind2Prover` gives parse error when disproving a property HOT 10
- ' ' is not a nondigit error HOT 4
- Formal methods with stateful functions HOT 4
- `copilot-core`: Remove deprecated functions in `Copilot.Core.Type` and `Copilot.Core.Type.Array` HOT 6
- `copilot-core`: Increase test coverage HOT 6
- Release 3.19 HOT 6
- Release 3.19.1 HOT 6
- `copilot-theorem`: Extend range of versions `what4` to include 1.6 HOT 7
- `copilot-language`: Remove deprecated function `Copilot.Language.Spec.forall` HOT 6
- `copilot-language`: Support modifying fields of structs HOT 6
- Release 3.20 HOT 6
- `copilot-theorem`: Support translating struct updates to `what4` HOT 5
- `copilot-core`: Add documentation for `updateField` describing how (and why) to implement it
- `copilot-prettyprinter`: Support pretty-printing struct updates HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copilot.