Re: Optimization Level
Re: Optimization Level
- Subject: Re: Optimization Level
- From: koko <email@hidden>
- Date: Thu, 20 Oct 2016 15:54:53 -0600
Thanks to all for the info ... we refactored code to pass pointers rather than references so we could check for NULL. No optimizations problems.
-koko
> On Oct 17, 2016, at 12:49 PM, Wim Lewis <email@hidden> wrote:
>
>
> 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
_______________________________________________
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