-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Labels
arduino mocksCompilation mocks for the Arduino libraryCompilation mocks for the Arduino libraryenhancementNew feature or requestNew feature or request
Description
A post to the arduino developers' mailing list suggests a smarter way to do macros for (e.g.) max
using "statement expressions":
#define max(a,b) \
({ typeof (a) _a = (a); \
typeof (b) _b = (b); \
_a > _b ? _a : _b; })
Adopting this will prevent double-evaluating a
and b
if for some reason they themselves are expressions with side effects.
Metadata
Metadata
Assignees
Labels
arduino mocksCompilation mocks for the Arduino libraryCompilation mocks for the Arduino libraryenhancementNew feature or requestNew feature or request