Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By cjdshaw
#92302 Very basic bit of code:
Code: Select allint initFunc() {
}

void setup() {
  Serial.begin(19200);
  initFunc();
}

void loop() {
}


So initFunc should return an int but doesn't, but setup ignores the return value. In C, this would generate a
warning: control reaches end of non-void function [-Wreturn-type]
but runs fine.
On Arduino/ESP8266 it compiles fine, but then triggers an exception, which seems extreme. Is there a logic to this that I'm missing, or is it a bug?
Using board 3.0.2 and Arduino 1.8.13
User avatar
By prgvitor
#92359
cjdshaw wrote:Very basic bit of code:
Code: Select allint initFunc() {
}

void setup() {
  Serial.begin(19200);
  initFunc();
}

void loop() {
}


So initFunc should return an int but doesn't, but setup ignores the return value. In C, this would generate a
warning: control reaches end of non-void function [-Wreturn-type]
but runs fine.
On Arduino/ESP8266 it compiles fine, but then triggers an exception, which seems extreme. Is there a logic to this that I'm missing, or is it a bug?
Using board 3.0.2 and Arduino 1.8.13



How must insert in the fuction "return", like that:

int function(void){


return 0; // Or other int value

}

If the function dont need returna a value, you must declare by "void", like that:

void function(void){


}