Message-Id: <1.5.4.32.19970807214727.0069a31c@dce03.ipt.br> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 07 Aug 1997 18:47:27 -0300 To: Charles Krug , djgpp AT delorie DOT com From: Cesar Scarpini Rabak Subject: Re: [Q] expression evaluation order Precedence: bulk At 09:10 07/08/97 +0100, Charles Krug wrote: >No. Wrong! > >I think that ANSI tries to demand left-to-right evalutaion of &&. But >not all compilers do this correctly. To guarantee left-to-right >evaluation, you need: ANSI does not _try_, it demands!, if some compiler does not conform is faulty (not 'buggy', which you could live with). In fact, this is a behaviour constructed in the design of the language: K&r 2nd ed. pg. 41 last par.: "... Expressions connected by && or || are evaluated left to right, and evaluation stops as soon as the truth or falsehood of the result is known. Most C programs rely on these properties." This is basic in C! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Cesar Scarpini Rabak E-mail: csrabak AT ipt DOT br DME/ASC Phone: 55-11-268-3522 Ext.350 IPT - Instituto de Pesquisas Tecnologicas Fax: 55-11-268-5996 Av. Prof. Almeida Prado, 532. Sao Paulo - SP 05508-901 BRAZIL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~