On Mon, 29 Jun 2009, Olin Lathrop wrote: > Russell McMahon wrote: > > K&R & Wirth were contemporaneous enough in their initial releases to > > (arguably) be considered sons of the same age. > > Not really. I'm pretty sure I looked this up before and found that Pascal > predated C. Algol certainly predated both, and if I remember right (I may > not), Algol also got this right. In other words, there were examples of > better ways to do case statements that K+R most likely were aware of, and > certainly should have been aware of, when they specified C. They really > have no excuse. I think K+R had a little excuse :-) First off ALGOL 60 select statements ('CASE' expr 'OF') didn't have labels. The expression was used as an index into a list of statements and only the statement corresponding to the index was executed. Secondly C was derived from BCPL which used labels and break statements as C does today. So at the time there were 3 ways of doing a select statement, the ALGOL way, the BCPL way and the PASCAL way. There were probably others that I am not aware of. Personnally I don't like the fact that you can forget to add a break statement at the end of a 'case' in C or that you can embed 'case' labels part way through if statements. ALGOL 60 type select statements was also bad because you needed to count the statements by hand to see which one was being executed for a given index. Easy to make mistakes if you're copying something in from paper and you accidently skip a statement. Assigning a meaning to a manifest constant and binding this to code also becomes difficult. Think about what happens if you want to add or delete a constant from a list. You need to go through all your code and ensure that your select statements correspond to your list of constants. Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist