|
|
|
|
|
by konstmonst
2337 days ago
|
|
I think a lot of misra rules are bullshit and not account for improvements in computer science. - goto is useful for error handling and when you have to double break - function pointers are useful and easy to read state machines and also for functional programming, which is sometimes easier to comprehend and produces better patterns - "Restrict functions to a single printed page." in my experience does not work. I would rather partition functions by topic or by level of "zoom"/abstraction - "Use a minimum of two runtime assertions per function." that doesn't really say anything useful imho. Use as much as experience tells you too. I agree with the rest |
|
a la
bool noNaNs(float[] test); bool isSorted(inout float[]); float[] sort(float[] input) in(input.noNaNs) out(o; o.isSorted) { return input; }
Not sure about goto, I'm not sure what I prefer between goto or a while loop and a very big switch statement (let's say) to implement a lexer.