Skip to content

Non void functions that has no return statements (undefined behavior) #47

Description

@JoakimCh

I see a lot of functions in the code where the return statement is missing or is kept inside if blocks that may not execute. I am very surprised to see such badly written code which doesn't conform to any standards. Does anyone know the reasoning for this?

An example:

uint8_t EVShieldBank::motorWaitUntilTachoDone(SH_Motor which_motors)
{
  uint8_t s;
  delay(50);  // this delay is required for the status byte to be available for reading.
  s = motorIsTachoDone(which_motors);
  while (( s & SH_STATUS_TACHO ) != 0 ) {
    delay (50);
    s = motorIsTachoDone(which_motors);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions