• 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: Pass-by value… warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pass-by value… warning


  • Subject: Re: Pass-by value… warning
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 7 Jul 2010 18:58:17 -0500

On Jul 7, 2010, at 10:27 AM, Greg Guerin wrote:

> vincent habchi wrote:
>
>> That's true, the compiler cannot guarantee that dim > 1, which is always the case actually.
>> I am going to put an extra text at the beginning of the method, like: "if (dim < 1) return;" and see what happens.
>
> If you need to guarantee dim > 1, then your if statement should be:
> if (dim <= 1) return

Also, you can use an assertion, even a custom assertion <http://clang-analyzer.llvm.org/annotations.html#custom_assertions>, and the analyzer will recognize it as truncating that particular code path.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Pass-by value… warning (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: NSWindowController window returns nil
  • Next by Date: Re: Sanity Check
  • Previous by thread: Re: Pass-by value… warning
  • Next by thread: Custom control and cells
  • Index(es):
    • Date
    • Thread