Rule 8-5-2 what is "non-zero initialization"? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.8 Declarators (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=137) +---- Thread: Rule 8-5-2 what is "non-zero initialization"? (/showthread.php?tid=1308) |
Rule 8-5-2 what is "non-zero initialization"? - grunwald - 24-01-2017 C++ has the concepts:
The term "non-zero initialization" is not defined anywhere. Code: struct POD { int member1; int member2; }; The declaration `pod` is clearly compliant with Rule 8-5-2. What about `udc`? If it is classified as "non-zero initialization", Rule 8-5-2 would require an explicit initializator for each element: Code: UserDefinedCtor udc[3] = { UserDefinedCtor(), UserDefinedCtor(), UserDefinedCtor() }; But maybe "zero initialization" in this rule does not refer to the C++ concept, but instead to the syntactic forms "{}", "{0}" and "{NULL}" ? Re: Rule 8-5-2 what is "non-zero initialization"? - misra cpp - 12-07-2017 We agree with your interpretation and this will be addressed in the next version |