
On Monday, December 07, 2015 at 06:47:36 PM, Wolfgang Denk wrote:
Dear Marek,
In message 1449507714-9599-1-git-send-email-marex@denx.de you wrote:
Second is the coding which causes gcc 4.9.x and newer scream gruesome death and murder. The expression !x == 0 && !x == 1 is ambiguous and should instead be rewritten into (x != 0) && (x != 1) to be correct.
But (!x == 0) && (!x == 1) ist not the same as (x != 0) && (x != 1); assume x=2:
(!2 == 0) && (!2 == 1) => (0 == 0) && (0 == 1) => 1 && 0 => 0
(2 != 0) && (2 != 1) => 1 && 1 => 1
???
This really depends on where you put the parenthesis and GCC complains about such ambiguous expressions. That's what the paragraph is about. I never said that ((!x) == 0) && ((!x) == 1) <=> (x != 0) && (x != 1) or equally ((!x) == 0) && ((!x) == 1) <=> !(x == 0) && !(x == 1)
Best regards, Marek Vasut