avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] possible compiler/optimizer problem (?)


From: Ned Konz
Subject: Re: [avr-gcc-list] possible compiler/optimizer problem (?)
Date: Mon, 30 May 2005 10:54:03 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041204)

Gary Douglas wrote:

Not sure if this is a bug, or if what I'm trying to do is just incorrect C syntax. Regardless, the compiler doesn't warn about the following:
[snip]
value != value;//This is the problem line - always true
[snip]
If I change it to this it works:
[snip]
    value = (!value); //This works...
[snip]
Are these not fundamentally the same?

No.

value != value;

is just a Boolean expression (which should always be false, but since its value is not used, the compiler probably throws the test away); it's not an assignment.

What probably is confusing is that C provides some composite operator/assignment operators:

+= -= *= /= &= |= ^= %= <<= >>=

but != is one of the test operators that happen to end in '=':

!= == >= <=

--
Ned Konz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]