🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1262

Re: Is an argument to break, continue a bad idea?

#1262
From: Aaron Henley
Date: Wed, 02 May 1990 18:34
47 lines
3361 bytes
henry@utzoo.uucp (Henry Spencer) writes:
>Why use loops, or ifs, or any other control structures, which replace some
>subset of the functionality of the goto?  Because they are easier to read
>and harder to make mistakes with.  The proposal wasn't to make break the
>same as goto, but to provide a way of using break to exit multiple levels
>of loops.  Since humans find counting levels difficult, one should tag the
>levels with names rather than requiring a count.  Nobody has suggested the
>equivalent of "#define break goto"; break would still be constrained to use
>only for exiting loops (well, and switches).  The constraint is important,
>indeed crucial; without it, one might as well use goto.

Noted, I misinterpreted this discussion, sorry.  Does break <label> statement
mean that the continue should also have a label?

>>... I do recommend people out there to
>>experiment with your code and look into your assembly listings if your
>>not sure of the best way to code a particular piece of code or if you
>>want to *REALLY* understand what your C code is doing!

>With a good optimizing compiler, you could spend all day just trying to
>figure out the relationship between what you wrote and what the compiler
>produced.  Not, generally, an enlightening exercise.  Also a fruitful source
>of misunderstandings, given the frequency of obscure compiler bugs.  To
>really understand C, you should study C, not assembler.

I have to disagree with this point.  I think people should and in many
cases must be aware of how their compiler allocates memory for structures,
what happens when you typecast a word from a memory location starting at a
point that isn't word aligned, etc...  These and many other usages of C are
ambiguously defined.  Just as there are a large frequency of obscure compiler
bugs, there are several ways different compilers handle ambiguous situations,
many of which cannot be found in the compiler's documentation.

My intent was not to suggest that you create a C program and then study
the assembly listing, but inorder to write efficient C code that does
what you want, you may have to consider what your compiler is generating.
So test the code in question in a small test program and see what the
assembly code looks like, neither of which should be time consuming.  If
your interest is very specific you should have little or no trouble tracking
down the functionality of the code in question.

Aaron
-- 
   ___________________________________________________________________
  /  Aaron Henley, Motorola Inc.      DISCLAIMER: std.disclaimer     /
 / Cellular Infrastructure Division   UUCP: ...!uunet!motcid!henley /
/__________________________________________________________________/
Technical Details
Message-ID: <2746@mica6.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!motcid!henley
References: <1990Apr25.180007.13243@cunixf.cc.columbia.edu> <12694@smoke.BRL.MIL> <2647@mica6.UUCP> <1990Apr28.232221.20725@utzoo.uucp> <2700@mica6.UUCP> <1990May1.165701.4289@utzoo.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!motcid!henley
From: henley@motcid.UUCP (Aaron Henley)
Newsgroups: comp.std.c
Subject: Re: Is an argument to break, continue a bad idea?
Message-ID: <2746@mica6.UUCP>
Date: 2 May 90 18:34:49 GMT
References: <1990Apr25.180007.13243@cunixf.cc.columbia.edu> <12694@smoke.BRL.MIL> <2647@mica6.UUCP> <1990Apr28.232221.20725@utzoo.uucp> <2700@mica6.UUCP> <1990May1.165701.4289@utzoo.uucp>
Reply-To: motcid!henley@uunet.uu.net
Organization: Motorola Inc., Cellular Infrastructure Div., Arlington Heights, IL
Lines: 47