Mail Archives: djgpp/1997/08/07/17:50:42
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Raw text -