Re:The Lost Art of Structure Packing (2018)
by banachtarski on Monday April 27, 2020 @11:37AM
(#22996830)
Wrong answer. This is brittle and relies on the memory always being initialized correctly and will be prone to all sorts of issues in the wild. Better is just either templatize on the key type or store the size on the map.
[ Parent
| on HN ]
To be clear, there are obviously different/better ways to handle this in C++. We're talking about K&R C here.
Re:The Lost Art of Structure Packing (2018)
by banachtarski on Monday April 27, 2020 @03:11PM
(#22998909)
Right I mentioned "store size of the key on the map" as the second option for K&R/Ansi C.