sergio masci wrote: > switch (x) > { > case 1: > > if (x == a) > { > x++; > } > else > { > case 2: > x = 0; > } > } > > ... > > I've just tried to compile the above using GCC and it went through OK. Yucc! Yet another entry to add to the long list of bad design choices for C. Responsible languages make each case a block so you can't do this. They also optimize for the common case of where you want to execute a single case from the list of choices. If after executing the code for one case you want to execute the next listed case, you should be forced to specify this explicitly. Wirth and Jenson got this right in Pascal, for example, so there was no excuse for K+R to have messed it up later in C. In Pascal a example of the equivalent to a C SWITCH looks like this: case number of {which number did he enter ?} 1: writeln ('Single.'); 2: writeln ('Couple.'); 4: writeln ('Quad.'); 12: writeln ('Dozen.'); 13: begin writeln ('That is a unlucky number.'); writeln ('Beware of heavy trucks when crossing the street.'); goto roll_truck; end; {end of number=13 case} otherwise writeln ('That is not a special number, try again.'); goto retry; end; {end of whole CASE statement} Note that the whole CASE statement is exited after the chosen case is executed. For example, if NUMBER is two the program will print "Couple." and not then continue by printing "Quad.". If you want that, you have to explicitly use a lable and a GOTO. This optimizes for the vast majority of cases where you want to execute the code for a single case only. It makes simple human mistakes less likely to occur in the first place, and more likely to be caught by the compiler when they do occur. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist