• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Optimization Level
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Optimization Level (From: koko <email@hidden>)
 >Re: Optimization Level (From: Wim Lewis <email@hidden>)

  • Prev by Date: Re: Downgrading Xcode version
  • Next by Date: Where are the Xcode 8 editor extensions?
  • Previous by thread: Re: Optimization Level
  • Next by thread: Mysterious linker warning "direct access … to global weak symbol … cannot be overridden at runtime"
  • Index(es):
    • Date
    • Thread