3 ms·
I completely agree. Most Misra software is embedded without dynamic allocation though, so you usually don't get into this situation too often. I think an excep
by carlmr 8y ago
I completely agree. Most Misra software is embedded without dynamic allocation though, so you usually don't get into this situation too often.
I think an exception here makes sense
- acprog42 8y ago> Most Misra software is embedded without dynamic allocation though True, but I've seen enough MISRA code bases plagued with the "Christmas tree" layout even if dynamic memory allocation isn't allowed. This was just a generic example most people can relate to.
- carlmr 8y agoI just checked, and MISRA 2012 seems to allow goto again under certain preconditions (you have to have a label declared in the same function and it has to be in the same block). So actually you can do proper error handling again. Still single return statement, which usually makes for more spaghetti.
- acprog42 8y agoYeah, seems like it actually allows my second example which is good! :)