> > As a Pascal programmer, I was taught that anything that makes the program > > more readable is good. This does not seem to qualify on that count. What's > > more, it seems to muddle the entire while loop by mixing assignment and > > increment with the test portion. > > I agree with you completely. Just because you CAN do something in C in one > line doesn't mean you should. The biggest long term cost of software is > maintenance, so most of the code should be optimized for clarity and to > reduce the chance someone might overlook a detail. Most of this comes at no > cost in cycles or code space because the compiler rearranges things > internally into sequential operations anyway. It's just a matter of laying > out the source code in an easy to follow manner, and of course including > good comments. So would you be as comfortable with one line of cryptic-looking code with five lines of comments explaining it, or five lines of perfectly clear code with one line of comments? Or five and five? Personally I tend toward the first: void strcpy (char *s, char *t) { // This will copy from *t into *s, incrementing each // pointer and looping until a null is encountered in // *t. Once we see a null, *s = *t evaluates to 0 // and the while loop ends. while (*s++ = *t++); } I tend to do it that way for a couple of reasons -- first, since I still consider myself to be something of a novice C programmer, I like to go through my code a few times to see if I can optimize it further before the compiler gets to it. Second, it leaves enough bread crumbs behind that when I look at it later on I can remember what I did and why. That's nice no matter how many lines you use to do the same thing. Of course, to be more accurate in this particular case I should say I *would* do it that way if I were clever enough to have squeezed it down that far int he first place. I doubt I would have figured out how to make it *that* concise. Dale -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.