Skip to main content
6 events
when toggle format what by license comment
Jan 6, 2015 at 17:10 comment added Brythan My experience is that after someone else breaks it, I own it again. So I've found that writing a little defensively means that I have less work to do. Also, think about when you were writing this -- did you do it correctly the first time? If not, why do you expect that you will do it correctly when you are modifying the existing code, which is much harder (because you forgot things that you once knew). Right now is when you have the best understanding of the code. Six months from now, understanding the code will be harder than it is now.
Jan 6, 2015 at 17:01 comment added Log Honestly, I am unsure about handling the pointer issues you brought up, because it strikes me as a form of defensive programming employed against fellow programmers (instead of malicious users). It doesn't make sense to me because programmers using and changing the code ought to do it right, otherwise they fully deserve to get bitten (especially in a language such C). I'll admit that probably, you are in the practical right and I'm in the idealistic wrong (where also, hardware never malfunctions).
Jan 6, 2015 at 11:50 comment added Brythan @Log You'd almost certainly need a bug. Think of what happens if ra_begin > ra_end for example. Or what happens with REGIONB_SIZE if you get rid of rb_begin and do not check rb_end for NULL before returning.
Jan 6, 2015 at 10:59 vote accept Log
Jan 6, 2015 at 10:59 comment added Log Thanks, rb_begin truly is useless. (How could I miss that?) As for the implicit cast from ptrdiff_t to size_t, I'm trying to see when that would be a problem.
Jan 5, 2015 at 15:17 history answered Brythan CC BY-SA 3.0