Skip to content

Comment on Reflections on Curly Braces – Apple’s SSL Bug and What We Should Learn From It

Comments

I would also add:

* For critical code, enable as many compiler warnings as you can while remaining sane. This would definitely include unreachable code warnings.

* Consider using static analysis

* Initialise your error variable in the "error" state not in the "everything is ok" state

Here's one more to add:

* Stop copying and pasting the same code over and over. If you do a complex series of operations several times, encapsulate them in a function/method.

I came here to make your third point. I feel strongly that code should be written to "fail safe"-- error state should be assumed until calls return otherwise, etc.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.