From: Peter O. <po...@al...> - 2005-08-11 08:54:16
|
On Wed, 2005-08-10 at 20:18 +0100, Peter Onion wrote: > On Wed, 2005-08-10 at 15:01 -0400, Jim Paris wrote: > > If the pointers are constant, wouldn't it make more sense to just > > declare them as such? > > > > char * const months[12] = ... > > > > I'm pretty sure you'll get the same result. > > Indeed you do. Thanks for that tip ! Same result is so much as neither of them actually works ! It seems that when sdcc puts the array of pointers into the code space is uses this construct in the assembler file _months: DB LOW(_str_16), HIGH(_str_16), UPPER(_str_16) DB LOW(_str_17), HIGH(_str_17), UPPER(_str_17) ....... gpasm however pads these three byte lines out to 4 bytes. The code that accesses the array thinks the elements are 3 bytes long so multiples the index by 3. I've posted a bug report on the sdcc sourceforge web site. Peter |