Skip to content

Commit

Permalink
Clarify ub.md slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli authored Dec 25, 2024
1 parent a1c27fd commit 029b22f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/ub.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ the call to `make_string()` is evaluated first.
Once `make_string()` has returned, its local variables no longer exist,
and as you would expect, it is UB to access pointers that point into them.

A simple fix is to return the entire array from `make_string()`, not just the first character.
A simple fix is to return the entire array from `make_string()`, not just its location in memory.
In other words, we change `-> byte*` to `-> byte[50]`.
This gives us a new compiler error on a different line:

Expand Down

0 comments on commit 029b22f

Please sign in to comment.