On Wednesday 26 October 2005 01:42 pm, Christopher Smith wrote: > Stewart Stremler wrote: > > I admit that every so often I'm clever in code. I just try to make a > > point of not admiring such things too much. My problem is that I > > don't remember what the code does after a week or so... so I'm always > > the jerk who write that damn stupid piece of clever code that's hard > > to figure out. Writing code with maintenance in mind saves *me* effort. > > I tend to think of cleverness and "easy to figure out" as orthogonal > issues. Sometimes really clever approaches to coding make everything so > much simpler. Sure, cleverness for its own sake rarely results in code > that is manageable, but cleverness as a solution to a real design > problem frequently works out quite well. > > --Chris
In this case I wrote some macros that allowed me to import almost without change some C-like code into the heart of the simulator. It saved a lot of work and insured correctness of the code being tested within the simulator. Actually I think it is some of the best code I have written in quite a while. Using macros allowed me to have a lot of reuse of the framework that gets wrapped around these macros. Could it have been written with C++ and Templates, no doubt. Would it have been better, probably. Would I have delivered it on time, not likely. Now I have a chance to revisit the entire problem. YMMV, BobLQ -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
