Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: net.lang.c Subject: Re: What should be added to C Message-ID: <2834@utcsri.UUCP> Date: Sat, 24-May-86 21:44:00 EDT Article-I.D.: utcsri.2834 Posted: Sat May 24 21:44:00 1986 Date-Received: Sat, 24-May-86 22:30:38 EDT References: <1462@mmintl.UUCP> <5498@alice.uUCp> <1497@mmintl.UUCP> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 63 Summary: In article <1497@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: > >>> o An andif clause for if statements. > >You would write: > > if (A) { > X > } andif (B) { > Y > } else { > Z > } > >This is equivalent to: > > if (!(A)) goto _Z; > X > if (B) { > Y > } else { >_Z: > Z > } > Interesting - like a switch, but with dynamic conditions. How about actually writing it like a switch: switch(){ /* or just 'switch{' */ when A: X; break; when B: Y; break; default: Z; } A and B, are arbitrary expressions which are evaluated in sequence. Sorry about stealing the extra keyword. Actually, 'case' would work just as well; and it wouldn't really be confusing, since one type of switch *must* have a constant exp and the other type would have to have non-constant expressions in reasonable usage. This would be easy to compile, and much more readable than an if..else.. etc. >>> o Any sort of multi-level break statement. There is no syntacticly clean >>> way of adding this to C. I don't agree. what about statement ::= break ; | break constant_exp ; e.g. break 2; would break the current loop *and* the enclosing one. Of course, you can obfuscate this with #define BRKS 3; ... break BRKS; /* ;-) */ -- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg