C/C++ Arena

Step 2 of 6

Review: dangling references

std::string_view and references are cheap views of data owned by someone else. The classic review catch: a view that outlives what it points at. It compiles cleanly, often seems to work in testing, and then prints garbage in production.

Red flags to look for:

Your turn: this pull request adds a greeting helper and a Tag type. Both have lifetime bugs. Fix them by making each owner hold its own std::string. (The checks inspect the types too, since dangling-view bugs can seem to work by luck.)

Previous: Review: pagination Next: Review: leaks on the error path