On Sun, Sep 20, 2015 at 07:43:46AM -0400, Michael McConville wrote: > Otto Moerbeek wrote: > > I do not agree. You only have to remeber "that function does sensible > > error checking" and you do not have to remember at each spot which > > condition is the right one. > > > > Function are the major way of structuring code, use them. > > It's not the idea of functions that I'm questioning. I don't think > making a function for a simple if (x) then errx(...); condition is sane, > though. I'm a bit biased at the moment because I'm searching through the > tree for "creative" replacements for errx() et al.
If x is an expression involving relational operators, I do not like to see multiple copies of that. e.g. verifying if a condition should use > or >= is often hard enough. If I have to check that in multiple places, I'm wasting effort. Also, if I see a bug and fix it, I do like the fact that I do not have to check multiple occurrences of the same expression and decide if they are really the same or not. So even if a function increases the number of lines in a program, often it reduces complexity. -Otto