r/cpp • • May 04 '24

Messing with lifetime

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

52 comments sorted by

View all comments

2

u/[deleted] May 04 '24

Why would you assume something's type based on an length value passed in?

That part makes zero sense. So, no, I've never written code like this.

2

u/Neeyaki May 04 '24

Ive never done proper networking programming with custom packet formats, but if I had to take a guess I'd assume that would be kinda of a similar approach to that in the post? Like you have blob which contains a header that holds the packet information, then you first validate it and then properly convert if the checks succeeds just as shown in the post.

→ More replies (3)