Initialization of the form { 0 } in relation to Rule 11.9 - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.11 Pointer type conversions (https://forum.misra.org.uk/forumdisplay.php?fid=166) +---- Thread: Initialization of the form { 0 } in relation to Rule 11.9 (/showthread.php?tid=1066) |
Initialization of the form { 0 } in relation to Rule 11.9 - rgamble - 15-06-2014 Is the following example intended to be a violation of Rule 11.9? Code: #include While a strict interpretation seems to suggest this a technically a violation, Rule 9.2 specifically allows for an initializer of the form { 0 } which indicates that this (being a violation of 11.9) may not have been intended. Re: Initialization of the form { 0 } in relation to Rule 11. - misra-c - 25-06-2014 An exception should be present in rule 11.9 to permit the initialisation of array of pointers with "{0}". This is consistent with rule 9.2 and the exception to rule 10.3 for array of floats. Code: float_32 farr_ok1[3] = {0}; // compliant |