You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using these macros with function calls, the function get called twice (or multiple times), which cause potential bug (when function return different value)
Simple test program which show this bug
#include<Arduino.h>voidsetup() {
Serial.begin(9600);
}
voidloop() {
for (int i = 0; i < 20; i++) {
Serial.println(max(rand() % 10, 5));
}
while (true) {
// stop
}
}
In Arduino.h header file, there are these macro
When using these macros with function calls, the function get called twice (or multiple times), which cause potential bug (when function return different value)
Simple test program which show this bug
Reference: https://www.youtube.com/watch?v=j0_u26Vpb4w&t=632s
The text was updated successfully, but these errors were encountered: