Re: A: a new bug to old plain C
Basile Starynkevitch <[email protected]>
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2025-11-26 at 18:45 +0300, Александр Поваляев via Gcc-help wrote:
> Hi Matthias!!! Thank you a lot for jumping in this e-mail thread!
>
> Many compilers (including Intel and Clang and some others) compile "Foo**"
> -> "const Foo * const * const" conversion without errors.
>
> The rationale why do we need "const" is pretty simple. To make our code
> more error prone. And so to make some hint to compilers and may be to some
> static syntax analyzers.
> When I am writing code sometimes I need to specify and restrict behaviour
> of some functions, to provide and supply something which is usually called
> INVARIANT.
> Let me post a little example here:
>
> "
> // PRE-CONDITION: ...
> // POST-CONDITION: ...
> // INVARIANT: array 'arg' and all its elements won't be changed
You then probably should be interested by frama-c.com
And if you want a GCC plugin, you could improve the one I wrote long time ago on https://github.com/bstarynk/bismon
(you might even consider extending https://github.com/RefPerSys/RefPerSys and use your own GCC plugin with it)
Regards
--
Basile STARYNKEVITCH basile AT starynkevitch DOT net
8 rue de la Faïencerie http://starynkevitch.net/Basile/
92340 Bourg-la-Reine https://github.com/bstarynk
France https://github.com/RefPerSys/RefPerSys
https://orcid.org/0000-0003-0908-5250