3 ms·
Denote preconditions, postconditions, and invariants during interviews! It'll save your life when it comes to quickly finding the "off-by-one" bugs that tend t
by alexgartrell 16y ago
Denote preconditions, postconditions, and invariants during interviews! It'll save your life when it comes to quickly finding the "off-by-one" bugs that tend to be problematic when you're reinventing strcspan or another C string manipulation function, or doing some crazy recursion.
In real life, whenever I'm writing complex C functions, I always denote my preconditions, postconditions, and invariants. I also tend to denote non-obvious pre/post conditions above the functions, to optimize for the case of source-diving (when someone's just glimpsing around and trying to get the gist).