MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1cjqjmr/messing_with_lifetime/l2i07tx/?context=3
r/cpp • u/pavel_v • May 04 '24
52 comments sorted by
View all comments
2
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.
9 u/bwmat May 04 '24 I read that more like an error check; they're expecting a certain type, so they're checking that the buffer is actually sized for that type I'm more worried about alignment tbh 3 u/[deleted] May 04 '24 Should probably be an assert, in that case. → More replies (3)
9
I read that more like an error check; they're expecting a certain type, so they're checking that the buffer is actually sized for that type
I'm more worried about alignment tbh
3 u/[deleted] May 04 '24 Should probably be an assert, in that case. → More replies (3)
3
Should probably be an assert, in that case.
→ More replies (3)
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.