ok - a followup.

having found that:

{
const UInt32 bitRate[15] = { 0, 32000, 40000, 48000,  56000,  64000,   
80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000 };
return bitRate[bits];
}

Is triggering an A5 warning, I need to do the same job without globals
(I have turned on PC-Relative strings and PC-Relative constants in the  
project options, but they don't seem to fix this)

can anyone suggest an efficient way to do this that won't end up using the  
A5 register?

Other than a switch (which seems like a sledgehammer approach) or loading  
the data from a resource (slow?), I'm at a loss...

Thanks,

Rob




>
> On 10/24/07, Rob <[EMAIL PROTECTED]> wrote:
>> In a previous thread, Ben described things that you can't access when  
>> your
>> app is running as a sublaunch without globals
>>
>> "You cannot access any variables that aren't located on the stack.  This
>> includes global variables, static variables, and some kinds of constant
>> data."
>>
>> My question is - 'what kinds of constant data?'
>>
>> I know I can't use normal globals
>> I know I can't use static variables
>>
>> but what about initialisers
>>
>> RectangleType           bottomRect={0,145,160,15};
>> or
>> Char                    string[]={"initialise with string"};
>> or
>> StrCopy(stringP,"some text to copy");
>>
>> what is the underlying rule here - how do I know what Codewarrior will  
>> put
>> on the stack vs what it won't ???
>
> Actually, the question is "what will CodeWarrior put in PC-relative
> storage (code segment) and what will CW put in global storage (data
> segment that gets copied to the heap at app startup).
>
> Anonymous constant data that doesn't contain pointers will probably be
> PC-allocated.  The key is to use the "Disassemble" command and look at
> the function.  If you see code that uses A5, you've got global access.
>  If you're code uses PC, then you're OK.
>


-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to