Rule 20.4 (required): Dynamic heap memory allocation shall not be used.
Good luck writing misra-compliant web browser.
And yes, safe languages can be written in safe languages. See rust and servo.
Rust and servo are great projects, but I would say there's still some time before Rust can completely replace C/C++. The language is stable, but there's still a lot of tooling that needs to be built up, and the compiler needs to be more performant. I also think it needs a few more small features in order to truly compete with C++ (it's already on par with C, in my opinion), e.g. being able to specify sized traits as return types. Once that's all done I think starting new projects in C/C++ wouldn't make sense anymore.
> Good luck writing misra-compliant web browser.
I'd be delighted to see one. Statically pre-allocating a large continuous chunk of memory for the whole browser process lifetime would have been great.
And then, what do you do with that chunk? Since the amount of memory you need depends on the website (e.g. some might need memory for a canvas, others might display large tables, etc.), presumably you take parts of it and allocate them for the various tasks you need to do? So you just write your own dynamic memory allocator.
> So you just write your own dynamic memory allocator.
If the entire pool is reclaimed once page is rendered (and there is a way to handle the running out of space condition) it may not count as a rule violation, no more than incrementing an array index counter.
And, browser is hardly a mission-critical appliance.
Re:Let’s sunset C/C++
by huhtenberg on Friday August 14, 2015 @07:26AM
(#10059543)
This MISRA - https://en.wikipedia.org/wiki/MISRA_C ?
Re:Let’s sunset C/C++
by JustSomeNobody on Friday August 14, 2015 @07:41AM
(#10059592)
"... misra-compliant web browser."
Surely this is a joke.
Re:Let’s sunset C/C++
by RotsiserMho on Friday August 14, 2015 @09:43AM
(#10060050)
I so wish it were.
This would be similar to replacing all automobiles with stuffed animals because, who in the world ever heard of stuffed animals getting into pile-up wreaks on the freeway and causing death misery and misfortune.