Skip to content

Commit 8611588

Browse files
committed
Make preprocessor conditional false when identifier undefined
A preprocessor conditional directive intended to only evaluate as true when compiling for the Arduino Nano 33 BLE board was also evaluating as true when compiling for any board that didn't define the compared identifiers because undefined identifiers are replaced with 0 by the C/C++ preprocessor, making them equal. From the C++11 standard section 16.1, paragraph 4: > After all replacements due to macro expansion and the defined unary operator have been performed, all remaining identifiers and keywords 148 , except for true and false, are replaced with the pp-number 0 The fix is to modify the directive to check whether the macro has been defined.
1 parent b64fe15 commit 8611588

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

DHT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#define DHT21 21 /**< DHT TYPE 21 */
4848
#define AM2301 21 /**< AM2301 */
4949

50-
#if (TARGET_NAME == ARDUINO_NANO33BLE)
50+
#if defined(TARGET_NAME) && (TARGET_NAME == ARDUINO_NANO33BLE)
5151
#ifndef microsecondsToClockCycles
5252
/*!
5353
* As of 7 Sep 2020 the Arduino Nano 33 BLE boards do not have

0 commit comments

Comments
 (0)