oops, i forgot to say that i'm nevertheless surprised that CW would be
*that* aggressive at only level 2.  i would expect global constructors to
get eliminated only at the very highest optimization level.  heck, ideally
i'd expect a warning about them.


----- Original Message -----
From: Chris Antos <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Saturday, February 05, 2000 6:58 PM
Subject: Re: Another Debug-ROM catch


> many (most) optimizations are potentially unsafe.  that's why there are so
> many different options for which optimizations to enable, and pragmas to
> turn them off around certain pieces of code, etc.  as with any optimizing
> compiler, the higher the optimization level, the more likely that the
> developer will have to twiddle some pragmas around specific pieces of
code,
> to counteract aggressive optimizations.
>
> some optimizing compilers may choose to not even implement optimizations
> that might be unsafe.  that's all well and good, but they certainly won't
> produce as fast or compact code as compilers utilizing more aggressive
> optimizations.
>
>
> ----- Original Message -----
> From: Marshall Clow <[EMAIL PROTECTED]>
> To: Palm Developer Forum <[EMAIL PROTECTED]>
> Sent: Saturday, February 05, 2000 3:21 PM
> Subject: Re: Another Debug-ROM catch
>
>
> > At 10:23 PM -0800 2/4/00, Greg Lutz wrote:
> > >Well, my actual example involved calling WinCreateWindow() from within
> the constructor that was called to initialize a global variable.  But to
> illustrate the point about the CodeWarrior linker, here's an example
> (slightly extended for dramatic effect!).
> > >
> > >Create a project using C++ stationery (this example uses the stock CW
6.0
> release, with the PalmOS 3.0 SDK).  Create the following file "sub.cpp"
and
> add it to the project:
> > >
> > >    #include <Pilot.h>
> > >
> > >    class C {
> > >    public:
> > >        C() {
> > >            ErrDisplay("Got here");
> > >        }
> > >    };
> > >    C c;
> > >
> > >
> > >In the target settings dialog, set global optimizations to level 2.
> Build and execute the application(1).  It will do nothing.
> >
> > Thanks for the example.
> >
> > IMHO, this is incorrect behavior.
> > You have a global variable with a constructor.
> > That constructor has to be run, precisely because of possible side
> effects.
> >
> > [ More steps removed ]
> >
> > -- Marshall
> >
> > "The era of big government is over."
> >            Bill Clinton, State of the Union Address, January 23, 1996
> > Marshall Clow     Adobe Systems   <mailto:[EMAIL PROTECTED]>
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
> >
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to