From a2408d154eb9fa3fa9b07cc5a04e9b3744a9f81a Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 18 Feb 2014 19:34:04 +0100 Subject: Instead of #defining true and false, include stdbool.h In C++, true and false are language keywords, so there is no need to define them as macros. Including stdbool.h in C++ effectively changes nothing. In C, true, false and also the bool type are not available, but including stdbool.h will make them available. Using stdbool.h means that we get true, false and the bool type in whatever way the compiler thinks is best, which seems like a good idea to me. This also fixes the following compiler warnings if a .c file includes both stdbool.h and Arduino.h: warning: "true" redefined [enabled by default] #define true 0x1 warning: "false" redefined [enabled by default] #define false 0x0 This fixes #1570 and helps toward fixing #1728. This only changed the AVR core, the SAM core already doesn't define true and false (but doesn't include stdbool.h either). --- cores/arduino/Arduino.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'cores/arduino/Arduino.h') diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index e12ac82..ec1389e 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -21,6 +21,7 @@ #define Arduino_h #include +#include #include #include @@ -43,9 +44,6 @@ void yield(void); #define OUTPUT 0x1 #define INPUT_PULLUP 0x2 -#define true 0x1 -#define false 0x0 - #define PI 3.1415926535897932384626433832795 #define HALF_PI 1.5707963267948966192313216916398 #define TWO_PI 6.283185307179586476925286766559 -- cgit v1.2.3-18-g5258