A question of style

Jeff Aguilera jeffa at hpmwtd.HP.COM
Tue Nov 28 11:55:38 AEST 1989


> I think the correct word is "wary".  My reaction would be "uh-oh -- this
> programmer is putting his own convenience and the joys of clever coding
> above readability and maintainability -- better treat this code as an
> amateur production and not rely on it too much".

I guess you would object to this C++ code as well:

    short recognize::operator()()
    {
        if (!head) head=1,activate(); //avoid superfluous activations
        if (zero) tail=1; //recognize epsilon-transition
        return tail;
    }

    short recognize::operator<<(int n)
    { 
        if (tail=0,head|body) //turn machine off; scan only if internal states are active
            if ((this->*scan)(n),head=tail&&many) activate(); //Thompson's construction for Kleene closure
        return tail;
    }

I'm sure you object to

    1) nonintuitive operator overloading
    2) proper use of comma expression
    3) long lines
    4) terse comments, not aligned with tabstops
    5) use of = in if () statement
    6) avoidance of newlines
    7) avoidance of braces
    8) individualistic programming styles
    9) code that works so well it requires no maintenance
       (because I have a mathematical modeling proving that
       it works)

-----
jeffa



More information about the Comp.lang.c mailing list