🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2322

Re: use of the break statement

#2322
From: Andrew Dalgleish
Date: Mon, 18 Mar 1996 13:41
51 lines
2036 bytes
Michael J Zehr wrote:
> I would disagree with this.  The compiler writers should allocate their
> resources to optimize best for the most common code they compile.

True. This is only good business sense.

> 
> If someone wants to obscure what they are doing from the compiler
> (writing a loop with a goto instead of saying what they mean), then

Writing a loop with goto's might be *exactly* what they mean.

Aren't these functionally identical? 

  do
    statement;  
  while (exp);

  label:
    statement;
  if (exp)
    goto label;

If a compiler can't optimize this, I reserve the right to refuse 
to trust it's optimizations on more complex constructs.

> that's their choice.  But they shouldn't expect everyone else who is
> trying to be clear in communicating with the compiler to pay higher
> prices so the compiler writers can allocate more resources to a rare and
> avoidable circumstance.
> 
> It also slows the compilations down in the cases when someone is using a
> goto when it isn't a simple loop they're writing -- the compiler would
> have to check to determine the semantics to see if it could apply its
> optimzations.
> 

Possibly. 
Compilation time is not as big an issue as the correctness of the compiler output.

-- 
Andrew Dalgleish
Senior Software Engineer
Axon Research, Pty Ltd
6 Wallace Ave
Toorak, VIC
3142
AUSTRALIA
Tel:	+61-3-9826-5538
Fax:	+61-3-9824-0083
Email:	andrewd@axonet.com.au
Technical Details
Message-ID: <4ijp75$19v@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4hqedf$1m0@solutions.solon.com> <4i2k0n$8jd@solutions.solon.com> <4i97ht$8gb@solutions.solon.com> <4ianbt$h8m@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: Andrew Dalgleish <andrewd@axonet.com.au>
Newsgroups: comp.lang.c.moderated
Subject: Re: use of the break statement
Date: 18 Mar 1996 07:41:57 -0600
Organization: Axon Research, Pty Ltd
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4ijp75$19v@solutions.solon.com>
References: <4hqedf$1m0@solutions.solon.com> <4i2k0n$8jd@solutions.solon.com> <4i97ht$8gb@solutions.solon.com> <4ianbt$h8m@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Mailer: Mozilla 2.0 (Win95; I)