Messages in this thread | | | From | (Måns Rullgård) | Subject | Re: GCC 3.4 Heads-up | Date | Mon, 05 Jan 2004 02:38:54 +0100 |
| |
Bill Davidsen <davidsen@tmr.com> writes:
>> If you have local variables (register or not), the sane thing to do is >> if (a) >> b = d; >> else >> c = d; >> or variations on that. That's the readable code. > > But may lead to errors in maintenence. Your first example below avoids > that problem. Imagine instead of "d" you have a 40-50 character > RHS. Now imagine that the code needs to be changed. If you have the > long expression in two places then it invites the possiblility of > someone changing only one of them. You may never make mistakes, but > the rest of us do, and the conditional LHS avoids that.
What's wrong with
d = long_expression; if (a) b = d; else c = d;
Your long expression is still only in one place.
-- Måns Rullgård mru@kth.se
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |