cottrell@nbs-vms.ARPA (COTTRELL, JAMES) (10/02/85)
/* > > Some of us feel the same about breaks as we do about gotos. I won't use > > it, or continue either, and I won't let anyone in my shop use it. > > It is just a goto with an implicit label,... > > Well, now we know that this cat's either got some impressive coding > techniques or doesn't use switch statements. There are only two uses of > break, namely to exit the middle of a loop or to get out of (and usually > terminate) a branch of a switch. If switch is used without break, I'd like > to see how the coding works. Other than that, using break only to get out > of the middle of a loop is fairly unspectacular(!). Here's how he does his switches! It *really* works (under bsd 4.2 at least) main(argc) { int never = 0; switch (argc) { /* switch man sleepin' */ case 1: /* train a hundred & two */ printf("argc = 1\n"); /* is on the wrong track */ if (never) { /* & headin' for you! */ case 2: printf("argc = 2\n"); if (never) { case 3: printf("argc = 3\n"); if (never) { case 4: printf("argc = 4\n"); if (never) { default: printf("argc = ???\n"); } } } } } } Impressed? Well, you *did* ask! :-) > Dick Dunn {hao,ucbvax,allegra}!nbires!rcd (303)444-5710 x3086 > ...If you plant ice, you're gonna harvest wind. I'm not entirely sure I agree with you about adding construx to the language tho. I once saw this thruout a bunch of sources: #define repeat(x,n) for (x = 0; x < n; x++) On the other hand, if *that's* what it takes to scare off everyone from modifying my code, then macros away! :-) Whichever way your pleasure tends... jim cottrell@nbs */ ------
nather@utastro.UUCP (Ed Nather) (10/02/85)
> I'm not entirely sure I agree with you about adding construx to the > language tho. I once saw this thruout a bunch of sources: > I'm quite sure I disagree with the constructs you appear to be adding to the language --- the English language. #ifdef cottrell #define construx constructs #define tho though #define thruout throughout #endif -- Ed Nather Astronomy Dept, U of Texas @ Austin {allegra,ihnp4}!{noao,ut-sally}!utastro!nather nather@astro.UTEXAS.EDU