Re: Weird branch test evaluation when using vector size()
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