C & C++

C & C++

Made by DeepSource

Found incomplete function parameters in declaration CXX-W3032

Bug risk
Major
misra c 2012 rule 8 2

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.

Bad practice

int foo(int a, b) {  // bad - second parameter has no type
    return a + b;
}
void bar() { // bad - parameter section is empty
    // do something
}

Recommended

int foo(int a, int b) { // good
    return a + b;
}
void bar(void) { // good
    // do something
}