Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1104 Add release notes for non nullable function
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Eltzschig <[email protected]>
  • Loading branch information
elfenpiff committed Sep 22, 2022
1 parent bdb75dc commit 6f1bbed
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
- Extract `iceoryx_hoofs/platform` into separate package `iceoryx_platform` [\#1615](https://github.com/eclipse-iceoryx/iceoryx/issues/1615)
- `cxx::unique_ptr` is no longer nullable [\#1104](https://github.com/eclipse-iceoryx/iceoryx/issues/1104)
- Use builder pattern in mutex [\#1036](https://github.com/eclipse-iceoryx/iceoryx/issues/1036)
- `cxx::function` is no longer nullable [\#1104](https://github.com/eclipse-iceoryx/iceoryx/issues/1104)

**Workflow:**

Expand Down Expand Up @@ -461,3 +462,26 @@
.create(myMutex);
myMutex->lock();
```

24. `cxx::function` is no longer nullable.

```cxx
// before
cxx::function<void()> helloFunc = []{ std::cout << "hello world\n"; };
cxx::function<void()> emptyFunction;

if (helloFunc) { // required since the object could always be null
helloFunc();
}

// after
cxx::function<void()> helloFunc = []{ std::cout << "hello world\n"; };
cxx::optional<cxx::function<void()>> emptyPtr(cxx::nullopt); // if function shall be nullable use cxx::optional

// no more null check required since it is no longer nullable
helloFunc();
```

Compilers like ``gcc-12>`` and `clang>14` as well as static code analysis tools like `clang-tidy`
will warn the user with a used after move warning when one accesses a moved object. Accessing
a moved `unique_ptr` is well defined and behaves like dereferencing a `nullptr`.

0 comments on commit 6f1bbed

Please sign in to comment.