4 ms·
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 e
by banachtarski 6y ago
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.
- saagarjha 6y agoThe answer is wrong more because it relies on padding bytes having consistent values than a lack of templating.
- shawxe 6y agoTo be clear, there are obviously different/better ways to handle this in C++. We're talking about K&R C here.
- banachtarski 6y agoRight I mentioned "store size of the key on the map" as the second option for K&R/Ansi C.