• 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: Can switch be used here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can switch be used here?


  • Subject: Re: Can switch be used here?
  • From: Brad Bumgarner <email@hidden>
  • Date: Mon, 24 Jul 2006 11:28:49 -0600

Thanks for the info Chas.

Brad


On Jul 24, 2006, at 11:22 AM, Chas Spillar wrote:

If I remember correctly, a switch statement case must be a compiled time
integral value. That is, once the compilation is finished the value of the
case must be known. Thus, what you describe (using a boolean value) would
not work. If you can map the various boolean cases to match a single
integral value then it can be made to work. However, a laddered
if-then-else would be clearer.


E.g.

If (f==0) {
} else if (l = 0) {
} else if (f > l) {
} else if (f == l) {
} else if (f < l) {
}

Better would be to just subtract the two counts:

f - l

If the value is negative f is smaller than l, if the value is positive then
f is greater than l, if the value is 0 they are equivalent.


Chas.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Can switch be used here? (From: Chas Spillar <email@hidden>)

  • Prev by Date: Re: DO Message queueing issues
  • Next by Date: Re: Re: What is serializaton?
  • Previous by thread: Re: Can switch be used here?
  • Next by thread: NSStepper doesn't work with NSDecimalNumber (but everything else does)
  • Index(es):
    • Date
    • Thread