Shared Norms of C Programming?
Following a discussion on the “Plain Ordinary C” LinkedIn newsgroup, I started wondering about whether C Programmers (or programmers more generally) develop a shared sense of normal ways of programming, rather in the sense of “Norms” in psychology, these rules of thumb might alert you to something “not right” just because it’s very abnormal, and thus keep you away from “Here be dragons” areas on the map.
The particular example was a C newbie, writing a recursive call to main(). In fact, worse than that, main() called function f() which called main() again, i.e. it was Mutual Recursion involving main(). This seemed so weird and evil to me that I thought it was a very confused example - in fact, the recursive calls had no conditions, so it was a confused example that could not possibly work.
I suspect every individual C programmer develops their own personal sense of what’s normal, but the more interesting question is whether these individual senses combine into a Shared Norm. I don’t have an answer to this, but it’s interesting to think about:-)
A couple of my suggestions are:
Do not call main() from anywhere - it’s the entry point.
Do not use recursion when a simple iterative solution is available.