----- Original Message ----- From: M. Adam Davis To: Sent: Tuesday, September 12, 2000 12:05 PM Subject: Re: [EE]:GOTO > Strictly speaking, the only place GOTO is acceptable in C is in an error routine > (ie, if broke goto someplace safe, parse the error, exit the routine). This > prevents the processor from changing state (stack, memory, etc) so that your > error routine can have a full view of what state the processor was in when the > error occured. > > If using goto speeds up your routine significantly compared to typical loops and > control structures, then chances are your compiler doesn't do very good > optimization (or you aren't using the loops and control structures in an > efficient manner). If that's the case, then tell QA that you are using Goto to > get around compiler limitations (and get them to fund a good compiler). A good > compiler, compiling good C code without Goto should be as efficient as code with > Gotos in it. Not necessarily true! > If need be, program the critical loop in C (with or without goto), take the > assembly output, put it into the C program as inline assembly and hand optimize > it. They can't complain about using goto in assembly. ROTFL > It sounds like you are writing a routine which needs to be fast and efficient in > a high level language (C) where it might be more appropiate to use a lower level > language (assembly). C is designed as a high level language which discourages > the use of Goto, if I find that I cannot write a program without the use of > goto, then C is not the correct language to use. Sure, I could program it in C > with Goto, but the code becomes less portable, more difficult to maintain, and > becomes prone to the dreaded spaghetti code syndrome. Very good point > -Adam > > Peter Schultz wrote: > > > > Hi Guys, > > I need your opinion in the case of battle with the software QA department. > > They are saying GOTO in C not acceptable. > > I checked the books, some of them said no, some of them saying in some > > places there is a use for GOTO. > > My practice said, when writing code for PIC especially fast operation with > > nested loops > > ( like decoding noise RF Manchester transmission at 100 kbit/s ) GOTO is > > absolutely necessary. > > Any thought on that issue? > > Peter Schultz > > Minimed Inc. > > 12744 San Fernando Road, > > Sylmar, CA 91342 > > Phone: (818) 362-2358x3837 > > Pager: (818) 589-3148 > > E-mail: PeterS@minimed.com > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > use mailto:listserv@mitvma.mit.edu?body=SET%20PICList%20DIGEST > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > use mailto:listserv@mitvma.mit.edu?body=SET%20PICList%20DIGEST -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! use mailto:listserv@mitvma.mit.edu?body=SET%20PICList%20DIGEST