Bob Paddock <[EMAIL PROTECTED]> wrote:

> g:/winavr-20081205/lib/gcc/../../avr/include/avr/eeprom.h:199:
>  error: cast from 'const uint8_t*' to 'uint8_t' loses precision

Hmm, I wonder how we (as the authors of the library) could convince
GCC that this is OK in this case.  The respective code is:

__ATTR_PURE__ static __inline__ uint8_t eeprom_read_byte (const uint8_t *__p)
{
    do {} while (!eeprom_is_ready ());
#if E2END <= 0xFF
    EEARL = (uint8_t)__p;
#else
    EEAR = (uint16_t)__p;
#endif

....so the cast from pointer to uint8_t is only applied in situations
where we *know* the target AVR does not have more than 256 EEPROM
addresses, so losing precision is OK here.

Curious, if you replace that by a cast to uint16_t (which then gets
assigned to a uint8_t register), will it still complain?

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to