[Info-vax] decrementing & for loops in C
Bob Eager
rde42 at spamcop.net
Thu Jan 8 11:14:32 EST 2009
On Thu, 8 Jan 2009 16:01:13 UTC, billg999 at cs.uofs.edu (Bill Gunshannon)
wrote:
> In article <6sml69F71m8lU1 at mid.individual.net>,
> billg999 at cs.uofs.edu (Bill Gunshannon) writes:
> >
> > Maybe I will try some of the compilers I
> > have to see if one of them actually does it.
>
> OK, I tried it with GCC on x86. I tried using both "=" and "=="
> with and without the "-O" option.
>
> Results:
>
> == & no optimization: Loop is there but condition to execute loop never
> exists.
>
> = & no optimization: Loop code not even generated.
>
> == & "-O": Loop code including loop setup optimized out of code.
>
> = & "-O": Loop code including loop setup optimized out of code.
>
> So, GCC at least can tell the logic does not allow for execution of the
> loop and takes the appropriate action. Sadly, it does not contain code
> the cause the computer to reach out and slap the programmer on the back
> of the head.
Try using: gcc -Wparentheses ...
--
Bob Eager
More information about the Info-vax
mailing list