[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #31613] In pgm_read_byte the address is a byte inste
From: |
Joerg Wunsch |
Subject: |
[avr-libc-dev] [bug #31613] In pgm_read_byte the address is a byte instead of an int |
Date: |
Wed, 10 Nov 2010 16:07:22 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.0.19) Gecko/2010071610 Firefox/3.0.19 |
Follow-up Comment #3, bug #31613 (project avr-libc):
> but I cannot see an error in the attached example.
The error is:
unsigned int *ptab;
Make this:
unsigned char *ptab;
and it will work as expected. The pointer *points* to a
"char" object, yet the pointer itself (i.e., the temporary
variable "ptab") is 16 bits wide anyway.
Despite, useless use of a pointer variable.
j = pgm_read_byte(testtab + yy);
would work without problems, as would
j = pgm_read_byte(&testtab[yy]);
Please, use the avr-gcc-list for that kind of questions.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?31613>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/