On Fri, 19 Dec 1997, Kingmundi wrote: > i was going through some of my compiler warning messages, > specifically some unreachable code messages, > all of it follows the same format as the following example, > > switch (mode) { > case SCMD_DROP: > obj_to_room(obj, ch->in_room); > return 0; > break; > case SCMD_DONATE: > > i was wondering why the switch statements all follow the practice > of following return0 with a break statement? is it a precaution? > The break really isn't needed there because of the return statement, but some compilers will scream and shout if the break isn't there because according to the standards it has to be there. Was goofing around with compiling under Win95 (EWw... Yuk!) and found a compiler off the Internet that would complain about missing default statements in switch, but gcc never said a word...... John Evans <evansj@hi-line.net> http://www.hi-line.net/~evansj/ Duct tape is like the force. It has a light side, a dark side and it binds the universe together. +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST