Function declarations should name all parameters explicitly with the correct type.
Functions with no parameters should use the void
type instead of leaving the parameter section empty, as mandated by MISRA C:2012 Rule 8.2.
int foo(int a, b) { // bad - second parameter has no type
return a + b;
}
void bar() { // bad - parameter section is empty
// do something
}
int foo(int a, int b) { // good
return a + b;
}
void bar(void) { // good
// do something
}