Wacky Programming Tales

James Logajan JamesL at Lugoj.Com
Sun Aug 15 17:31:17 EDT 1999


Kaz Kylheku wrote:
> 
> On 15 Aug 1999 03:14:48 GMT, Ben Caradoc-Davies <bmcd at es.co.nz> wrote:
> >[strange programming]
> >The most confidence uninspiring piece of code I ever had the displeasure to
> >maintain contained something like this (allegedly C++, but mainly it's
> >intersection with C):
> >
> >       i = 0;
> >       while( i < max_index ) {
> >               /* some copying or update (not modifying i) goes here */
> >               i = i + 1;
> >       }
> >
> >This was written by a *very* expensive consultant working for a large
> >multinational accountancy firm.
> 
> So what's wrong with that?
[Nice defense elided.]

Those that think that code is bad have I suspect have never seen bad code.
Anyway, I bet many people missed the really bad part in that code, which is
the placement of the { <Wink>. Note the only approved location for curly
brackets:

i = 0;
while(i < max_index)
{
    /* Blah blah. */
    i = i + 1;
}

(I use Python whenever I can just to get away from these curly bracket wars.
<0.7 wink>)




More information about the Python-list mailing list