File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
14
14
### Removed
15
15
16
16
### Fixed
17
+ - Compile errors / portability issues in ` WString.h ` and ` Print.h ` , first reported by ` dfrencham ` on GitHub
17
18
18
19
### Security
19
20
Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
3
#include < stdio.h>
4
+ #include < avr/pgmspace.h>
4
5
#include " WString.h"
5
6
6
7
#define DEC 10
Original file line number Diff line number Diff line change 9
9
10
10
typedef std::string string;
11
11
12
+ // work around some portability issues
13
+ #if defined(__clang__)
14
+ #define ARDUINOCI_ISNAN ::isnan
15
+ #define ARDUINOCI_ISINF ::isinf
16
+ #elif defined(__GNUC__) || defined(__GNUG__)
17
+ #define ARDUINOCI_ISNAN std::isnan
18
+ #define ARDUINOCI_ISINF std::isinf
19
+ #elif defined(_MSC_VER)
20
+ // TODO: no idea
21
+ #define ARDUINOCI_ISNAN ::isnan
22
+ #define ARDUINOCI_ISINF ::isinf
23
+ #else
24
+ #define ARDUINOCI_ISNAN ::isnan
25
+ #define ARDUINOCI_ISINF ::isinf
26
+ #endif
27
+
12
28
class __FlashStringHelper ;
13
29
#define F (string_literal ) (reinterpret_cast <const __FlashStringHelper *>(PSTR(string_literal)))
14
30
@@ -36,8 +52,8 @@ class String: public string
36
52
37
53
static string dtoas (double val, int decimalPlaces) {
38
54
double r = 0.5 * pow (0.1 , decimalPlaces); // make sure that integer truncation will properly round
39
- if (std::isnan (val)) return " nan" ;
40
- if (std::isinf (val)) return " inf" ;
55
+ if (ARDUINOCI_ISNAN (val)) return " nan" ;
56
+ if (ARDUINOCI_ISINF (val)) return " inf" ;
41
57
val += val > 0 ? r : -r;
42
58
if (val > 4294967040.0 ) return " ovf" ;
43
59
if (val <-4294967040.0 ) return " ovf" ;
You can’t perform that action at this time.
0 commit comments