avr-libc-dev
[Top][All Lists]
Advanced

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

Re: can't reproduce documented overflow behavior of _delay_ms()


From: Georg-Johann Lay
Subject: Re: can't reproduce documented overflow behavior of _delay_ms()
Date: Tue, 04 Feb 2020 22:51:23 +0100
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

Joerg Wunsch schrieb:
 > No, obviously, the documentation is wrong, and the delay functions
clip the delay value at a __builtin_avr_delay_cycles() value of
UINT_MAX rather than setting it to 0.

However, I just revisited the C standard on this.  All this is simply
undefined behaviour: the internal calculation is performed with a
"double" argument type, which is eventually then converted to
uint32_t, thereby overflowing the uint32_t domain.

hmmm. So there is more word to do for double support? We definitely do not want double here but float instead...

Johann



reply via email to

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