[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] eeprom_rb strangeness??
From: |
Thedore A. Roth |
Subject: |
[avr-libc-dev] eeprom_rb strangeness?? |
Date: |
Thu, 31 Oct 2002 23:27:51 -0800 (PST) |
Hi,
I just noticed that all the eeprom_* function don't take pointers as args
for the addr. This seems a bit odd to me. For example the proto for
eeprom_rb() is:
unsigned char eeprom_rb (unsigned int addr);
I would think that this should be:
unsigned char eeprom_rb (unsigned char *addr);
Also, I would think that eeprom_rw() should be:
unsigned int eeprom_rw (unsigned int *addr);
Changing these would make things like this consistent with standard C
idioms:
struct data {
char a;
char b;
int c;
};
struct data ee_data [] __attribute__ ((section (".eeprom"))) = {
{ 1, 2, 3 },
{ 2, 4, 6 },
{ 0, 0, 0 }
};
int
main (void)
{
char aa = eeprom_rb (&ee_data[1].b);
return 0;
}
whereas the above would look like this with the current prototypes:
char aa = eeprom_rb ((unsigned int)&ee_data[1].b);
which seems a bit awkward to me.
Any comments?
Ted Roth
- [avr-libc-dev] eeprom_rb strangeness??,
Thedore A. Roth <=