[Top][All Lists]

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

Re: [avr-gcc-list] compiler bug?

From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] compiler bug?
Date: Tue, 10 Feb 2009 13:01:29 +0100

On Tue, 10 Feb 2009 11:45:52 +0000
Richard F <address@hidden> wrote:

> Hi
> Call me a newbie, but is there anything wrong with the following statement?
> rtc.time_element.tm_wday = (rtc.time_element.tm_wday < 6) ? 

a = ( a < 6 )

Looks  strange. the '<' is used to evaluate/test if a condition is true
or false. What the compiler is probably doing is testing the logical
(true or false) result of the expression rtc.time_element.tm_wday < 6
and then putting that back into rtc.time_element.tm_wday

Your week day will therefore be either 1 (result of evaluting the
right-hand expression is TRUE) or 0/False.

> rtc.time_element.tm_wday++ : 0;

This statement also looks very strange to me, I fail to understand what
you were trying to achieve when writing this...


reply via email to

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