Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 11.9 : Global initialization of pointers
#1
In this case :

1. int *ptr ; // Is this compliant or non compliant
2. void foo()
3. {
4. /* Do Something. */
5. }

Global variables are initialized to 0 by default.
This means ptr is initialized to 0 automatically by compiler.

Ques : Is line 1 compliant or non compliant to Rule 11.9.

Does this rule also enforce initializing ptr to NULL for global pointers. ?
<t></t>
#2
Rule 11.9 is not applicable to default initialisations. Your global declaration of "int *ptr;" does not violate rule 11.9.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)