in reply to My first thought was to build a macro... was I right?

How would you recode these two routines for succinctness?

Maximizing succinctness is not always a good idea. Sure, it'll make you feel clever if you can reduce your program to the minimum number of lines. But it has a tendency to become a maintenance problem. What happens if you discover a slight difference in the way the parameters, return values, or errors are handled in the two functions? You either undo the succinctification, or you create a godawful mess of special cases. If your code is being maintained by someone else, the chance that they pick option two is far too high.

Unless there's something you aren't telling us (like each function is actually 100 lines long, or there are 100 of these functions), it seems like you'd be better off applying your hubris somewhere it'll get better returns.

  • Comment on Re: My first thought was to build a macro... was I right?