Hi,
If a 32 bit
pointer can be somehow declared then this will be pretty elegant. If this
is not possible then the only alternative would be to change the function
parameters as shown below which is not really elegant.
void ReadXFlashBlock (unsigned char *destptr, long sourceaddr, unsigned int
noofbytes);
Yes we can and it has already been suggested: Define Your own abstract data
type with an underlying 32 bit integer. You can even overload all operators
for it to achieve full pointer semantics. But I would not go so far and
overload the dereferencing operator for readability reasons. The signature
for Your read function would then look like:
void ReadXFlashBlock (unsigned char* dst, FlashAddress src, unsigned int size);
If templates are Your friends, You can go further and add the value type to
Your abstract address type.
This way You avoid ugly casting orgies everywhere in Your code and You can
not mess up integers, internal memory pointers and external flash addresses.
Ok, these are features of avr-g++, but why not?
Richard
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list