
6 Aug
2010
6 Aug
'10
12:31 p.m.
Dear "Reinhard Meyer (-VC)",
In message 4C5BE2CF.2020306@emk-elektronik.de you wrote:
Instead of: static unsigned char buffer[ENC_MAX_FRM_LEN]; The following works fine: static unsigned long lbuffer[ENC_MAX_FRM_LEN/4]; #define buffer ((unsigned char *)lbuffer)
Is there a more elegant way of forcing a char array to start on an even address?
Sure. Use something like
static unsigned char buffer[ENC_MAX_FRM_LEN] __attribute__ ((aligned(4)));
Or, probably even better, use malloc() to allocate the buffer.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
It is impractical for the standard to attempt to constrain the
behavior of code that does not obey the constraints of the standard.
- Doug Gwyn