Re: Optimization Level
Re: Optimization Level
- Subject: Re: Optimization Level
- From: Wim Lewis <email@hidden>
- Date: Mon, 17 Oct 2016 11:49:15 -0700
On Oct 17, 2016, at 11:36 AM, koko <email@hidden> wrote:
> If I build a release configuration with the recommended optimization level (fastest, smallest) then this code
>
> void xxxxx::Clear(apointList &list)
> {
> if ( ! &list )
> return;
>
> }
>
> never returns when apointlis &list = 0x00000000 as shown in the debugger.
I'm not a C++ guru, but I believe that references are not allowed to be NULL — a reference is assumed to always point to a valid object. (This is one of the ways they differ from pointers.) Since no valid object can be at address 0, the compiler can optimize out that test.
If it's possible for a NULL to be passed into that method, it should probably take a pointer to an apointList instead of a reference to one.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden