16-11-2011, 12:43 PM
Hello,
I wanted to confirm if having local static variables with the same name in different functions is not compliant with rule 5.5.
For example:
This is similar to http://www.misra-c.com/forum/viewtopic.php?f=61&t=812 and http://www.misra-c.com/forum/viewtopic.p...=962#p1807 but I just wanted a clear confirmation.
Thanks
I wanted to confirm if having local static variables with the same name in different functions is not compliant with rule 5.5.
For example:
Code:
void foo1() {
static int x1 = 0; /* Not compliant - foo1, foo2 */
static int x2 = 0; /* Not compliant - foo1, foo2 */
}
void foo2() {
static int x1 = 0; /* Not compilant - foo1, foo2 */
int x2; /* Not compliant - foo1, foo2 */
int x3; /* Not compliant - global, foo2 */
}
extern int x3; /* Not compliant - global, foo2 */
This is similar to http://www.misra-c.com/forum/viewtopic.php?f=61&t=812 and http://www.misra-c.com/forum/viewtopic.p...=962#p1807 but I just wanted a clear confirmation.
Thanks