r/cpp • • May 04 '24

Messing with lifetime

https://biowpn.github.io/bioweapon/2024/05/03/messing-with-lifetime.html
42 Upvotes

52 comments sorted by

View all comments

Show parent comment

3

u/PhyllophagaZz May 04 '24

there are many C APIs that force you to write code like this. The assert is not 'assuming' a type, it's just weakly asserting the data isn't truncated or something.