¬
¬a\\/b
On Wed, 9 May 2007 08:28:19 +0100, "Malcolm McLean"
[snip]
Unless you can show that UB errors are more common than deterministic errors
in dangerous malfunctions, I will fund it hard to believe. Controlled flight
into terrain and all that.
It's unnecessary to show that "UB errors are more common than
deterministic errors in dangerous malfunctions".
You should strive to eliminate UB errors completely, so that you can
focus on the task of finding deterministic errors. The former
(striving to eliminate UB errors) is one of the primary tenets the
honorable posters to this newsgroup attempt to dissuade people like
you and me from. And for good reason.
Someone may use a ring buffer in the software for a flight control
system, and they may use something like the following to increment the
current index of the buffer:
#define BUF_SIZE 256
...
i = i++ % BUF_SIZE;
Furthermore, their DO-178B Level A testing may show that this works
just fine. Nevertheless, it is a time bomb waiting to fire off,
because it is undefined behavior.
With a change to a different compiler or even a change to the next
release of the same compiler, the above may not "work" as expected.
(I can hear the echoes of management through the hall--Do we really
need to re-run *all* of the regression tests for the next N weeks,
seeing that all we did was change to the next revision of the same
compiler?).
It's better to avoid such undefined behavior in the first place, so
that you can focus on the "deterministic errors".
I think that is along the lines of what Mr. Heathfield and others are
more or less saying, and I whole heartedly agree with them.
"i = i++ % BUF_SIZE;"
non dovrebbe avere nessun "indefinite behaviorur" e si puo' unicamente
intendere come
"i=i%BUF_SIZE; ++i;"
lo standard che non limita UB sembra per me sbagliato
la direzione è diminuire al massimo i vostri "cari?" "UB"
in generale
f(a1, ... , ++a2, ... , --a3, ..., a4--, ... a5++)
= {++a2; --a3; --a4; ++a5;
return f(a1, ..., a3, ... a4-1, ..., a5+1);}
f(++a1, g(++a2)) <=> f(++a1, {++a2, return g(a2)})
<=> ++a1; f(a1, {++a2; return g(a2);})
<=> ++a2; ++a1; f(a1, g(a2);
facendo queste posizioni i vostri UB spariscono
qui ammetto che la "chiamata a funzione" e il ";" sono punti di
calcolo degli operandi (non ricordo come la chiamate mi sembra
"sequescion points")