Arduino.h Defines Macros that Should be Functions
moefrumkin opened this issue · 1 comments
moefrumkin commented
ArduinoCore-avr/cores/arduino/Arduino.h
Line 92 in 6309212
This macro and those that follow will lead to unexpected behavior if certain expressions are passed into it. For example,
int x = 0, y = 1;
printf("Min is: %d", min(++x, ++y));Will print 2 instead of 1 since the expansion gives the expression ((++x)<(++y)?(++x):(++y)). Is there a reason this shouldn't be a function?
per1234 commented
Hi @moefrumkin. Thanks for taking the time to submit an issue.
I see we have another report about this at #324.
It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.