At 10:16 AM 11/27/2003, Regis St-Gelais wrote:
Lets say I have the folloing global array (in C):
Int16 gintAnArray[10]     = {'1','2','3','4','5','6','7','8','9','0'};
and its external declaration
extern Int16 gintAnArray[10];

I can acces the array from any segment.

yes, as the array is placed in the data section.


But if I do this:
const Int16 gintAnArray[10]     = {'1','2','3','4','5','6','7','8','9','0'};
and its external declaration
extern const Int16 gintAnArray[10];

I can only access the array from the first segment.

This is due to having the "PC-relative const data" switch on. This make constant data accessed through the PC, which only allows intra-segment references. Turning that off would push the constant data into the data segment where it can be seen by all.


--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to