Thats true, but it depends on what the #define is for..

simple data types (Ints, longs chars etc) are o.k.

#define SomeInt (0)

void f ( )
{
        int i = SomeInt;
}

Will work, the compiler can make code that does not access globals

#define SomeString "This is a string"
void f ( )
{
        const char* str = SomeString
        Int l = StrLen(str);
}

Will crash, as SomeString is actually placed in the global data segment which is now unavailable.

You can work around this by setting the 'pc-relative strings' option in CW (and I assume a similar thing exists in gcc)


Jeff Loucks wrote:
Ummm...

#defines are used by the compiler (actually, the preprocessor) and are
not relevant after preprocessing.

On 8/30/06, Michael <[EMAIL PROTECTED]> wrote:
When my app gets started without access to it's global variables (e.g. from a sysAppLaunch), does it still have access to all of it's #defines? I read in another forum that it doesn't, but that seems fairly strange. Any ideas?
--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/




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

Reply via email to