Article View: net.lang.c
Article #9603Re: Expression sequencing query
From: Rahul Dhesi
Date: Thu, 16 Oct 1986 04:48
Date: Thu, 16 Oct 1986 04:48
20 lines
1345 bytes
1345 bytes
Peter S. Shenkin <cubsvax!peters@columbia.ARPA> writes:
<In article <umcp-cs.3769> chris@umcp-cs.UUCP (Chris Torek) writes:
<< result = a + b;
<< result += c;
<...
<...I wish there were some way of forcing order of execution, to
<this extent anyway, within a line.
Try this:
{int t = a + b; result = t + c;} /* note: force evaluation order */
This construct is general and it achieves the purpose. The extra variable
exists only in the block and doesn't clutter up the rest of the program. And
its very presence shouts "Careful!" to next person who modifies the code.
C doesn't cry wolf. Other languages do.
Rahul Dhesi <dhesi%bsu@csnet-relay.ARPA>
!seismo!csnet-relay.ARPA!bsu!dhesi
Yes, I know they go the wrong way.
Technical Details
Message-ID:
<4642@brl-smoke.ARPA>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!brl-adm!brl-smoke!smoke!00R0DHESI%bsu.csnet@CSNET-RELAY.ARPAShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!brl-adm!brl-smoke!smoke!00R0DHESI%bsu.csnet@CSNET-RELAY.ARPA From: 00R0DHESI%bsu.csnet@CSNET-RELAY.ARPA (Rahul Dhesi) Newsgroups: net.lang.c Subject: Re: Expression sequencing query Message-ID: <4642@brl-smoke.ARPA> Date: Thu, 16-Oct-86 00:48:58 EDT Article-I.D.: brl-smok.4642 Posted: Thu Oct 16 00:48:58 1986 Date-Received: Tue, 21-Oct-86 21:49:42 EDT Sender: news@brl-smoke.ARPA Lines: 20