Displaying 1 result from an estimated 1 matches for "protect_stack".
2024 Jul 27
1
C API - no NULL pointer guarantee?
...not too bad and provides null safety, but can get excessive.
See an example from one of my test functions (question mark unwraps the optional. asserting it is not null):
```
export fn testAsScalarVector() Robject {
const results = rzig.vec.allocVector(.List, 23).?.protect();
defer rzig.gc.protect_stack.unprotectAll();
results.?.setListObj(0, rzig.vec.asScalarVector(@as(f32, 1.32456e+32)));
results.?.setListObj(1, rzig.vec.asScalarVector(@as(f32, -9.87123e-32)));
results.?.setListObj(2, rzig.vec.asScalarVector(math.inf(f32)));
results.?.setListObj(3, rzig.vec.asScalarVector(-math....