4 ms·
The article has invariants in comments. I like to put invariants in assertions so they get checked at run time. I know this is common practice but I haven’t se
by robotresearcher 8y ago
The article has invariants in comments. I like to put invariants in assertions so they get checked at run time.
I know this is common practice but I haven’t seen it mentioned here and it might help someone.
edit: Jonsen's reply question, for which I don't have an answer, is instructive: these loop invariants are often impossible or impractical to achieve in assertions. I modified the above to be less wrong.
- jonsen 8y agoHow would write an assert for the sum loop invariant?
- deleted 8y ago[deleted]