• 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: Weird branch test evaluation when using vector size()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird branch test evaluation when using vector size()


  • Subject: Re: Weird branch test evaluation when using vector size()
  • From: Greg Guerin <email@hidden>
  • Date: Thu, 19 Mar 2009 09:03:37 -0700

Daniel Stenning wrote:

However if I assign buff->size() to a variable siz and then evaluate siz-1
As in OPTION B then executio goes down PATH B as I would expect.


What is going on ????

int I=0; // ( for example )
int siz = buff->size();

if ( ( buff->size() -1 )  >=i  )  { // OPTION A
//if ( (siz -1)  >=i  )  {  // OPTION B


Questions:

1. Is the upper-case variable "I" supposed to be the same as the lower-case variable "i" and vice versa? Do I ignore the apparent typos, or is the example missing some context?

2. What is the return-type of buff->size()? Might it be unsigned? If so, when is an unsigned expression ever less than 0?

  -- GG

_______________________________________________
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


  • Prev by Date: Re: Weird branch test evaluation when using vector size()
  • Next by Date: Re: Weird branch test evaluation when using vector size()
  • Previous by thread: Re: Weird branch test evaluation when using vector size()
  • Next by thread: Inheriting 'Preprocessor Macros' from Project settings
  • Index(es):
    • Date
    • Thread