Re:A critique of "How to C in 2016"
by dietrichepp on Friday January 15, 2016 @06:17AM
(#10908534)
The tools for rooting out these problems have gotten a lot better, thankfully. I'm very fond of the address sanitizer. Using calloc() everywhere can prevent the address sanitizer from finding problems.
[ Parent
| on HN ]
Re:A critique of "How to C in 2016"
by neopallium on Friday January 15, 2016 @08:30AM
(#10909145)
GCC (>=4.8) & Clang now have Address Sanitizer support for fast memory error detection. About a 2x slowdown [1].
0. https://github.com/google/sanitizers/wiki/AddressSanitizer 1. https://github.com/google/sanitizers/wiki/AddressSanitizerPe...
You could try to split the difference by using a wrapper around malloc that zeroes in production and doesn't under testing.
Of course, running significantly different code in production and test has its own issues.