Byron Jeff wrote: > I kind of like C's ability to use assignment as an expression. Hmm. I rather doubt there is any real efficiency gained from that by reasonably written compilers. > Again it > does facilitate a compactness of expression that other languages do > not have the ability to accomplish. That may have been K&R's intent, and perhaps there was some limited reason for it back then, but there is certainly little reason for it now. Clarity is far more important than compactness, and I think should have been back then too. I mostly care about compactness only as it enhances clarity. Go too far and it detracts from clarity. > BTW you didn't even get to the one that just sticks in my craw: > > The default drop through action of cases in the switch statement. Yeah, that's another good one. I totally agree the default should be to en= d the switch, not fall thru to the next case. The C SWITCH is just a compute= d GOTO, not a real selection of multiple cases as the syntax would lead a casual observer to believe. If they had named it MULTIJUMP or something, i= t wouldn't bother me so much, but then I'd still want a real multi-case statement. By the way, the Pascal CASE statement does work as you describe. For example: choice :=3D 1; case choice of 1: writeln ('1 was picked'); 3: writeln ('2 was picked'); 3: writeln ('3 was picked'); otherwise writeln ('Other was picked'); end; would only result in "1 was picked" to be written. You don't have to be a Pascal whiz to have a pretty good idea what the above code does. > The only argument that holds water is that since ranges are not > allowed, > the default fall through allows multiple cases to share the same code: > > choice =3D 1; > switch (choice) { > case 1: > case 2: > case 3: printf("1,2, or 3 was picked\n"); > break; > default: printf("other was picked\n"); > break; // Unneccessary but often put in for consistency. > } Pascal gets around it this way: case choice of 1, 2, 3: writeln ('1, 2, or 3 was picked'); otherwise writeln ('Other was picked'); end; In other words, you can't put a bunch of cases in a row and fall thru, but you can give each case multiple target values. I think that addresses your concern adequately enough. > switch (choice) { > case 1: continue; > case 2: continue; > case 3: printf("1,2, or 3 was picked\n"); > break; > default: printf("other was picked\n"); > break; // Unneccessary but often put in for consistency. > } Something like that, although as Martin pointed out, CONTINUE already has another meaning. I would be fine with this if a different and new keyword were used, like NEXTCASE for example. > Byron A. Jeff > Department Chair: IT/CS/CNET > College of Information and Mathematical Sciences > Clayton State University Hey, when did that happen? Congratulations! Is that the same place you were before, or did you have to go elsewhere to get promoted? Last I remember (probably a long time ago since my brain usually tunes out email signatures) you were someplace in Georgia. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .