FAQ: Someone know where to use "continue" [Archive] - Page 2 - C Board

PDA

View Full Version : FAQ: Someone know where to use "continue"


Pages : 1 [2]

beely
12-10-2002, 08:30 AM
Originally posted by quzah
We aren't talking about self-modifying code here. Once compiled, your program is done. All checks are finished, unless it's a scriptible application, in which case, this whole point is moot anyway.

As such, there is no scenario I can envision where your example would be valid. Furthremore, why couldn't I just add another && sitution?

This isn't a holy war over the evils of continue. By all means, do whatever you want. Just make your code readable and clear so the next person that has to maintain your code knows what the hell is going on. That's the whole point.

In everything you code, make sure the next idiot that follows you knows what's going on. Code as if an idiot is going to have to read your code after you're done with it.

Quzah.

i agree to quzah's comment. however, using the bad structure could make the whole program more confusing. i try to avoid using "GOTO, continue, break" if necessary. all of the certain things that i mention is bad structure in my mind. if let say that if ppl wan to use with this statement, never mind. it's ok for that ppl, but if they use it in certain time, the whole program look like untidy, unstructure. This is not included on the flowchart.

&& shouldn't hardly disturb on the exe time. i just add a variable to control it. am i right ?

beely
12-10-2002, 08:37 AM
another point is...
:: a good structure on program that made by the programmer usually follow on flowchart. most of the book, said that "break, goto, continue " is not recommended to place it on the program -- it's bad structure, you may find the the prove from : -
-- c how to program (deitel)
-- approch using c structure
-- how to design in c

i'm not argue that "break, goto, continue" is can't used it among others. everybody have freedom to choose which one is better. but i would prefer for my own design by adding another variable and control to loop, that's all. hope you dont mind on my comment.

Sayeh
12-10-2002, 08:53 AM
Actually, "continue" is convenient to use, for example, in a for:next loop, when you want the loop to iterate again without executing some additional code within the loop.

As for 'goto', the primary reason to use goto is for peformance. In many cases you can eliminate a test entirely or have an algorithm be much tighter and more direct by judicious use of a goto.

There is nothing wrong with either one. To say you should never use either one is like telling someone they should never pick their nose because it looks uncouth. Well I'm sorry, but there _is_ an appropriate time to pick your nose. Period. End of Discussion.


[rant = on]

I just wish a portion of people on this board would spend a little more time actually getting concepts and understanding what is going on in the machine, as opposed to getting hung up on truly pointless hyperbole. I watch too many people get "lost" on syntactic, grammatic, and "purist" issues, and they never actually get to concentrate on what's important: implementing _logic_.

Because that's what development is really about-- implementing logic in software.

beely
12-10-2002, 09:49 AM
well... sayeh, depend on it. what you prefer on is depend on situation. :D :D

i did tell this URL to my friends, you know one of my friend (expert in c program) did say ?
" .... depend on situation what type of program, i would rather choose your way (that's mean he agree on my program with adding && and variable) than using "break' because that kind of program is bad structure...."

2 of c program lecture did say...
" .... break's bad structure, avoid using it .... "

ok there guys, that's all about end of thread , and thanks for getting this challenging posted. wishing this thread will closed anyway.

:: depend on what you prefer to use, may use own style :: :D :D :D

rafe
12-10-2002, 09:52 AM
No point in arguing any more... Some people drank the cool-aid and some people didn't.:p

beely
12-10-2002, 10:02 AM
yeah, every ppl have diff mind and ideals , right :D :D no wonder there's will conflict with other co-worker on their project programming. LOL