> And the first complies with coding standards like gnu and gcc, > and maybe even others like misra etc.
MISRA doesn't say a lot about style, that is how pretty the code looks. It is implicit that ugly looking code is bad, and probably buggy. If your code looks like a IOCCC entry, your code would not be MISRA complaint. http://www.ioccc.org/ Per MISRA, in a nested if/else tree all brackets are required, and there must be a final else{} as you showed. As far as I can tell MISRA-2004 is silent on a preference between switch(), nested if/else() and function pointers. Personally I prefer tables of function pointers. Makes code looking like a threaded language like Forth at times. In any case what can get hairy fast is conditionals containing conditionals, which makes testing all execution paths problematic. Note that technically no AVR-LibC based project complies with MISRA due to rule #3.6 that says any library used, including the GCC libraries, must be complaint with MISRA [IEC 61508 Part 3]. I tend to follow the MISRA Guidelines anyway as it shows an attempt at Due Diligence. -- http://www.wearablesmartsensors.com/ http://www.softwaresafety.net/ http://www.designer-iii.com/ http://www.unusualresearch.com/ _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list