Skip to content

Commit cdfa2fe

Browse files
authored
Merge pull request #112 from ianfixes/2019-02-04_nullptr
Fix nullptr support again, remove custom implementation
2 parents 8f5868d + f01524c commit cdfa2fe

File tree

9 files changed

+113
-905
lines changed

9 files changed

+113
-905
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99
### Added
10+
- Proper `ostream operator <<` for `nullptr`
11+
- Proper comparison operations fro `nullptr`
1012

1113
### Changed
14+
- `Compare.h` heavily refactored to use a smallish macro
1215

1316
### Deprecated
1417

1518
### Removed
19+
- Homegrown implementation of `nullptr`
1620

1721
### Fixed
22+
- `nullptr` support (again)
1823

1924
### Security
2025

SampleProjects/TestSomething/test-something.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ int testSomething(void) {
33
millis(); // this line is only here to test that we're able to refer to the builtins
44
return 4;
55
};
6+
7+
int* aNullPointer(void) {
8+
int* ret = nullptr;
9+
return ret;
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#pragma once
22
#include <Arduino.h>
33
int testSomething(void);
4+
int *aNullPointer(void);

SampleProjects/TestSomething/test/library.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ unittest(library_tests_something)
66
assertEqual(4, testSomething());
77
}
88

9+
unittest(library_returns_nullptr)
10+
{
11+
assertEqual(nullptr, aNullPointer());
12+
}
13+
914
unittest_main()

cpp/arduino/Arduino.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Where possible, variable names from the Arduino library are used to avoid confli
1515
#include "Stream.h"
1616
#include "HardwareSerial.h"
1717
#include "SPI.h"
18-
#include "Nullptr.h"
1918

2019
typedef bool boolean;
2120
typedef uint8_t byte;

cpp/arduino/Nullptr.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

cpp/unittest/ArduinoUnitTests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include "OstreamHelpers.h"
34
#include "Assertion.h"
45
#include <iostream>
56
using namespace std;

0 commit comments

Comments
 (0)