Problem with Switch statement ?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2004
Posts: 4,451
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 250
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Problem with Switch statement ?

 
0
  #11
Aug 11th, 2005
Originally Posted by bandm
It's not that I ignored it, I tried it and it and got tons more errors than before I tried it.
That's good. They were hidden by this one previously. Now the compiler can point them out.

Originally Posted by Dave Sinkula
Then some more errors that can be fixed by enclosing the statements for the switch within {}.
Originally Posted by bandm
Doesn't putting the variable outside the brackets just make them global?
I wouldn't think that it should effect anything, then I am just a greenhorn trying to learn.
You didn't put them outside the function so much as in no-man's-land.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 19
Reputation: bandm is an unknown quantity at this point 
Solved Threads: 0
bandm's Avatar
bandm bandm is offline Offline
Newbie Poster

Re: Problem with Switch statement ?

 
0
  #12
Aug 11th, 2005
All Right!

Now we're talkin. I just didn't understand the {} thing in the earlier post.
I'm still on a learning curve, but I sur appreciate the help here.

I thought the comiler caught all the errors and listed them, but now I see that it sometimes will return before checking all of them. Correct?

Thanks, Guy's

BandM
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,451
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 250
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Problem with Switch statement ?

 
0
  #13
Aug 11th, 2005
Originally Posted by bandm
I thought the comiler caught all the errors and listed them, but now I see that it sometimes will return before checking all of them. Correct?
Some errors can cause the whole rest of the program look like a single statement and cut short the number of true errors. Other errors, like a missing semicolon, can produce piles of false error messages.
Last edited by Dave Sinkula; Aug 11th, 2005 at 4:24 pm. Reason: Changed 'line' to 'program'.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC