Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: evaluation order Message-ID: <11060@smoke.BRL.MIL> Date: 14 Sep 89 11:52:24 GMT References: <9361@attctc.Dallas.TX.US> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 9 In article <9361@attctc.Dallas.TX.US> bobc@attctc.Dallas.TX.US (Bob Calbridge) writes: >if (write(handle, buf, len=strlen(buf)) != len) do_something(); >can I be assured that 'len' will be assigned the length of 'buf' before it >is used on the right side of the comparison operator. No. Either side of != may be evaluated first, depending on the implementation. It's best to split such multiple actions into separate statements; you don't get any extra credit for complexity of the expression.