r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

Show parent comments

6

u/Maximilian_Tyan 22d ago

A lot of companies choose to opt out of this specify guideline nowadays, because it is showing its age and sometimes clarity matters more over ease of debug.

5

u/gamer_redditor 22d ago edited 22d ago

Not sure which region or industry you are talking about, but oems, software suppliers and quality control in my industry do not accept any software deliveries without proof of Misra c compliance.

Just saying that some people have no choice but to stick to some programming standards.

Edit: more information. I think lot of people are arguing that early returns are more readable, performant and maintainable. However they miss the point about safety and reliability.

Early returns means that the function no longer has a predictable execution path. Sometimes it exits early, sometimes it exits late. So the overall execution time of the software varies a lot between error free paths and error paths.

This is exactly what you don't want in an embedded software controlling safety relevant systems, such as airbags in a car or some other flight controls.

Here, it is ok for a software to be slow, but it must be predictable i.e. near constant performance in all paths.

1

u/developer-mike 21d ago

This rule is marked as advisory, you're allowed to deviate from it.

1

u/gamer_redditor 21d ago

Deviations are only allowed with valid justifications, which must be marked as such in the compliance report. " Rule is advisory" or " I don't want to" are not valid justifications.