Re: MISRA


Nicolas Pitre <nico@...>
 

On Mon, 20 Dec 2021, Abramo Bagnara wrote:

Il 19/12/21 23:36, Nicolas Pitre ha scritto:
all compilers capable of compiling Zephyr I have access to do produce
the right result, *all* the time. It is true whether or not the pointer
being NULL is known at compile time (when it is the compiler also does
constant propagation optimizations on it). It is not because something
is "undefined" that it is necessarily "forbidden".
No, it is not forbidden, it is in the domain "you can do what you want, but be
prepared to pay the price" and the price is unspecified.
For the n-th time I'll repeat this: it can be tested.

In this particular case it is extensively tested by the CI
infrastructure. In the unlikely event one compiler implementation
decides to exercise its freedom to change the existing behavior then
we'll know about it right away.

But you keep on dismissing this fact.

PS: You should have a look at tests/lib/c_lib/src/main.c. Lots of
"undefined" stuff being tested in there, including not very useful
stuff.


Nicolas

Join {devel@lists.zephyrproject.org to automatically receive all group messages.