[Top][All Lists]

[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:
value != value;//This is the problem line - always true
If I change it to this it works:
    value = (!value); //This works...
Are these not fundamentally the same?


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]