Article View: net.lang.c
Article #9077Re: e1?(void_e2):(void_e3) so, is it legal or what?
From: Cary Timar
Date: Tue, 26 Aug 1986 00:26
Date: Tue, 26 Aug 1986 00:26
32 lines
1277 bytes
1277 bytes
In article <248@desint.UUCP> geoff@desint.UUCP (Geoff Kuenning) writes:
>
>Unfortunately, Brett is incorrect here. You can't use if/then/else to write:
>
> for (i = up ? 0 : 99; up ? (i < 100) : (i >= 0); up ? i++ : i--)
> {
> /* complex loop body */
> }
>
>without duplicating code. On the other hand, anywhere you want do
What about:
if (up)
{
i = 0;
step = 1;
}
else
{
i = 99;
step = -1;
}
for (; i < 100 && i >= 0; i += step)
{
/* complex loop body */
}
????
-- Cary Timar /* NOT REACHABLE */
< Generic Disclaimer >
Technical Details
Message-ID:
<114@methods.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!methods!caryReferences:
<518@hadron.UUCP> <243@desint.UUCP> <745@wjvax.wjvax.UUCP> <248@desint.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site methods.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!methods!cary From: cary@methods.UUCP (Cary Timar ) Newsgroups: net.lang.c,net.bugs Subject: Re: e1?(void_e2):(void_e3) so, is it legal or what? Message-ID: <114@methods.UUCP> Date: Mon, 25-Aug-86 20:26:05 EDT Article-I.D.: methods.114 Posted: Mon Aug 25 20:26:05 1986 Date-Received: Thu, 28-Aug-86 04:11:41 EDT References: <518@hadron.UUCP> <243@desint.UUCP> <745@wjvax.wjvax.UUCP> <248@desint.UUCP> Reply-To: cary@methods.UUCP (Cary Timar (U of W co-op)) Organization: Methodsworks, Inc., Burlington, Ont. Lines: 32