[nostalgia,olympic] Replace oxIgnoreError with std::ignore

This commit is contained in:
2024-04-22 23:40:48 -05:00
parent ea1feb726e
commit ed4f0e1f2b
11 changed files with 27 additions and 30 deletions

View File

@ -222,8 +222,8 @@ int caller2() {
```
Lastly, there are a few macros available to help in passing ```ox::Error```s
back up the call stack, ```oxReturnError```, ```oxThrowError```,
```oxIgnoreError```, and ```oxRequire```.
back up the call stack, ```oxReturnError```, ```oxThrowError```, and
```oxRequire```.
```oxReturnError``` is by far the more helpful of the two.
```oxReturnError``` will return an ```ox::Error``` if it is not 0 and
@ -232,13 +232,10 @@ Because exceptions are disabled for GBA builds and thus cannot be used in the
engine, ```oxThrowError``` is only really useful at the boundary between
engine libraries and Nostalgia Studio.
```oxIgnoreError``` does what it says, it ignores the error.
Since ```ox::Error``` is always nodiscard, you must do something with them.
In extremely rare cases, you may not have anything you can do with them or you
may know the code will never fail in that particular instance.
This should be used very sparingly.
At the time of this writing, it has only been used 4 times in 20,000 lines of
code.
In rare cases, you may not have anything you can do with them or you may know
the code will never fail in that particular instance.
This should be used sparingly.
```cpp
@ -257,7 +254,7 @@ ox::Error engineCode() noexcept {
void anyCode() {
auto [val, err] = foo(1);
oxIgnoreError(err);
std::ignore = err;
doStuff(val);
}
```