2012-05-10 Currently, I'm reading ``The UNIX System'' by S.R. Bourne. The book is similar to ``The UNIX Programming Environment'' by Ker- nighan and Pike, but more targeted to users. (Note that users of Unix are tought sh, C and troff. This is part of the philosophy of the system.) While the book by Kernighan and Pike is a clas- sic, the book by Bourne is hardly known. I like Bourne's book a lot because it gives very good and compact introductions into a lot of topics. Complex declarations in C are large obstacles for newcomers. But they don't require any guru knowledge, in fact, they don't even require thinking. It's even better not to think at all but only operate as state machine. This document describes how: [0]. It's not at all difficult. Have a look at this snippet of command line argument handling code in C: while (argc > 0 && **argv == '-') { switch (argv[0][1]) { case 'e': --argc; ++argv; if (argc == 0) usage(); include_event(*argv); --argc; ++argv; break; case 'i': --argc; ++argv; if (argc == 0) usage(); interval = atoi(*argv); if (interval == 0) usage(); --argc; ++argv; break; default: usage(); } } It appears as if this kind of compact code writing is typical for lecturers. They want to fill up their slides and provide the au- dience as large a window into the code as possible (with readable font size). Take the one line: --argc; ++argv; if (argc == 0) usage(); It's four or five lines of code in a decent layouting style. I believe that few code (i.e. few code entities and short iden- tifiers) is good. I believe that the brevity of C can improve the readability of the code for programmers who are familiar with this style. But I think that the structure of the code should follow a clear schema. To me the rules are: One statement, one line. The body of each control statement is a block in curly braces, having the closing brace on the same column with the keyword. These rules are violated here. The code is too much Perl-style. That's when reading becomes difficult. I can accept to have `argc--; argv++;' on one line together, be- cause it connects the two statements together, making them effec- tively one operation. A similar case is pushing to a linked list: node->next = head; head = node; I'm indifferent whether to write them into one line or not. I do like to have a short comment ``push'' here; I find it con- venient. When the statements are on two lines, I don't know where to best put the comment. ;-) Still, I rather have them on two lines. [0] http://ieng9.ucsd.edu/~cs30x/rt_lt.rule.html http://marmaro.de/lue/ markus schnalke