13

I think a little background can't hurt, so here it goes:

I work in a software company. Back in the day, in this very same company, a fellow programmer had an idea: let's indent our (module) code in such a way that the whole code represents or is similar to some unique feat of the given module - so, that you can just cat away to quickly see what an unknown file is for (I'll give an example in a bit). Well, the idea grew popular and we have a rather significant code base that follows this style.

An example: this source code is an excerpt from a module that's part of a test suite for remote ASCII-enabled terminals on systems which track date. (If what you see below looks bad, then you really don't want to see the more GUI-y stuff.)

char      *P="110"   "2No???"   "Fn" "_^w?"     
"??"     "Ff"  "_{" "{~"  "r^" "?F" ""  "_{"    
"{{"     "x~"  "fv" "_n"  "s{" "xx"    "ff"     
"_{{~p"  "wF"  "f_" "{{"  "{@" "wN"   "ro"  ""  
"??"      "{?????"   "~w{??}"  "??"    "~o??" "\
?]?B{B~"                       "F}"           "\
]Fz~ffnN"   "]N"              "K{F"             
            "fn"                                
"N]"  "F_"  "{F"       "fn"     "N]ro"  "{B"    
"~F"  "}N"  "^_",*p,   i,j,      k=0;  main     
# define I  pu##  t##  ch##  ar  /*20  11*/     
(){p  =3+P  ;for  (;*  ++p;++i%  8||I( 10))     
for(  k=6;  k--;)I(1  << k&*p-         63?P     
 [j=j?j-1                        :3]:  32);     
  return                         !/*c */1;}     

Now, of course for each benefit there's a downside, and for this convention it's pretty clear: maintainability and to some extent, readability.

The example above is not really a good example on maintainability, but we do have a sensible approach (of using padding space) to the problem, and it is, I think, well under control. However, some younger programmers continue to voice problems regarding code readability, and even I begin to have problems, understanding why. After all, we have always striven for standard conformance in any language we use, as you can see above.

So, what I can't quite grasp is that if code is standard-conforming, and the compiler has no problems with it ? how can the programmer have? After all, the language rules are rather simple, so it's not that hard to (mentally) follow them; the situation is of course different if the code contains "hack-ish solutions", but we generally avoid them, for portability reasons amongst others. Would it be help if the code was written in C99?

How should I enlighten them? Am I missing something obvious?

4 accepted

They are young, and they must learn that code is not written for humans, but for machines.

Human readability, when achieved, is just a nice side-effect. But it is not needed.

2

According to C99 Section 4, paragraph 1, subparagraph 2011, this code is absolutely fine.