using millis and yield in a while loop to delay causes esp8266 watchdog reset..?

unsigned long start = millis();
while( millis() - start < 10*1000){ // let 10 seconds go by without impacting other cpu functions

Can someone please help me understand why the code above causes the watchdog to rest the esp given Im calling yield in the while loop?


You’re actually not calling yield because you forgot the parentheses. If you change it to yield(); the problem should be solved.

This is not a function call, and has no effect in the code:


This is the correct function call:


curious why the compiler didn't catch that....?

Thank you both!

If you set "Compiler warnings" to "All" in Arduino IDE, you get a warning:

warning: statement has no effect

It is not an error because it is valid C/C++ code.