Skip to content

Compiler doesn't throw warnings for a function not returning valid type #681

@arihantdaga

Description

@arihantdaga

For hours i was stuck when my mcu was going in an indefinite loop. Later i found that one of the function was being called continuous in loop, while i called that function only once.

Later i discovered that it was because the parent function which was calling this function had a syntax of return bool, but in code, i forgot to return anything.

void func1();

// Faulty Method
bool myfunction(){    
    func1();
    // Forgot to return a boolean value. 
}


void myMainFunction(){
    int a = 0;
    myfunction();
}

I was wondering if compiler can throw the error for such function.
I am not sure, i think maybe these compiler warnings could be out of scope from the arduino core. Or is there any option, to enable warning levels etc at the compilation time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions