[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] eeprom.h error: cast from 'const uint8_t*' to 'uint8_t' l
From: |
Bob Paddock |
Subject: |
[avr-gcc-list] eeprom.h error: cast from 'const uint8_t*' to 'uint8_t' loses precision in c++ |
Date: |
Mon, 8 Dec 2008 13:04:26 -0500 |
I was starting a new project and wanted to do it in C++, mostly to get
the better type checking. I'm aware of the C++ caveats in the FAQ/Manual.
However I did not get very far before I ran into an error:
g:/winavr-20081205/lib/gcc/../../avr/include/avr/eeprom.h:
In function 'uint8_t eeprom_read_byte(const uint8_t*)':
g:/winavr-20081205/lib/gcc/../../avr/include/avr/eeprom.h:199:
error: cast from 'const uint8_t*' to 'uint8_t' loses precision
Are the standard AVR headers not c++ safe or am I doing something
wrong? The same example program, below, compiles without error as
normal C code.
Full sepal:
-------- begin --------
avr-gcc (WinAVR 20081205) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling C++: Main/main.cpp
avr-gcc -c -mmcu=attiny88 -I. -x c++ -gdwarf-2 -DF_CPU=8000000UL
-Os -funsigned-char -funsigned-bitfields
-fpack-struct -fshort-enums -fno-exceptions
-Wall -Wundef -Wa,-adhlns=LT_A_OBJs/Main/main.lst
-MMD -MP -MF .dep/main.o.d Main/main.cpp -o LT_A_OBJs/Main/main.o
In file included from Main/main.cpp:7:
g:/winavr-20081205/lib/gcc/../../avr/include/avr/eeprom.h:
In function 'uint8_t eeprom_read_byte(const uint8_t*)':
g:/winavr-20081205/lib/gcc/../../avr/include/avr/eeprom.h:199:
error: cast from 'const uint8_t*' to 'uint8_t' loses precision
make[1]: *** [LT_A_OBJs/Main/main.o] Error 1
make[1]: Leaving directory `G:/BKU/Projects/LITETR~2/SOURCE~1'
make: *** [all] Error 2
-------- end --------
Example program, same results without the _cplusplus guards
as well:
-------- begin --------
#if defined(__cplusplus) && __cplusplus
extern "C" {
#endif
#include <avr/io.h>
#include <avr/eeprom.h>
#if defined(__cplusplus) && __cplusplus
}
#endif
int main( void ) __attribute__ ((OS_main));
int main( void )
{
for(;;)
;
}
-------- end --------
- [avr-gcc-list] eeprom.h error: cast from 'const uint8_t*' to 'uint8_t' loses precision in c++,
Bob Paddock <=