News for hackers. Stuff that matters.
Re:Rust is now overall faster than C in benchmarks by MaxBarraclough on Monday January 04, 2021 @07:47AM (#25630614)
And even MISRA C isn't enough to assure the absence of undefined behaviour.

C is a tricky beast to tame.

Re:Rust is now overall faster than C in benchmarks by tormeh on Monday January 04, 2021 @07:53AM (#25630664)
Not such a big deal in embedded, where the compiler and hardware is always the same, which means that the behavior is still predictable even if undefined
Re:Rust is now overall faster than C in benchmarks by enedil on Monday January 04, 2021 @09:45AM (#25631918)
This is not true. Undefined behaviour can mean that

``` bool b; if (b) printf("1 "); if (!b) printf("2 "); ```

might print `1 2 `.

Re:Rust is now overall faster than C in benchmarks by MaxBarraclough on Monday January 04, 2021 @11:03AM (#25633042)
Right on. Unless the compiler documentation promises a consistent handling of the various triggers of undefined behaviour, it is under no obligation to always generate code that handles UB consistently.

To my knowledge there is no C compiler that promises to always handle all forms of UB consistently. The closest you could get would probably be something like Valgrind.

Re:Rust is now overall faster than C in benchmarks by pjmlp on Monday January 04, 2021 @03:01PM (#25637049)
At least for this specific case Microsoft and Google are fixing it by always initializing the variables.
Re:Rust is now overall faster than C in benchmarks by greyhair on Monday January 04, 2021 @06:30PM (#25639739)
It's not like that is hard to fix, and modern compilers will flag uninitialized variables.

Use your brain and use your tools. C is not really that hard for a large number of problem sets.

Re:Rust is now overall faster than C in benchmarks by pjmlp on Tuesday January 05, 2021 @02:07AM (#25642951)
Yet, CVE database is full of well known companies that apparently lack such developers.

If their salaries cannot find them, where are they?

Do we have a candidate to prove their secure reports as being wrong?

Re:Rust is now overall faster than C in benchmarks by MaxBarraclough on Tuesday January 05, 2021 @06:39AM (#25644488)
> It's not like that is hard to fix

In an embedded context, such bugs may be extremely costly to fix, if it's even possible.

> modern compilers will flag uninitialized variables

Reading uninitialized variables is one of the more easily prevented forms of undefined behaviour. As pjmlp points out, undefined behaviour in C/C++ programs is one of the major sources of security vulnerabilities in today's software.