comp.lang.ada
 help / color / mirror / Atom feed
From: alex@MIMSY.CS.UMD.EDU  (Alex Blakemore)
Subject: Re: and then
Date: 10 Apr 93 19:52:36 GMT	[thread overview]
Message-ID: <66288@mimsy.umd.edu> (raw)

In article <1993Apr9.180808.19494@scf.loral.com> bashford@srs.loral.com (Dave B
ashford) writes:

> I can't believe my eyes - "desired side-effect" in Ada ?
> The only reason I can think of not to optimize to short circuit forms is to c
atch
> undesired side-effects.

typically I agree
but what's important is to have the same behavior on different systems so 
if a function may raise an excepion - it should be called just in case.

> Are there "desired side-effects" ?
 
sometimes:

  one class of beneficial side affect doesnt effect semantics but may
affect performance - .e.g. data structures that reorganize on queries
to optimize requests for recently visited info - akin to caching

  somtimes a side effect is intended every time a function is evaluated:
such as in a pseudo-random number generator or a lexical scanner perhaps
but its by far the exception and should be documented.

> Should compilers optimize when, because of poor programming, the
> behaviour of the program might change ?

this caused a lot of debate in the Ada9X forum in the case when 
certain range checks could be safely eliminated (optimized away) 
without changing the semantics _except_ in the erroneous case
where a variable is referenced before being initialized.

If I understand the new 9X proposal, they have a reasonable solution.
-- 
---------------------------------------------------
Alex Blakemore alex@cs.umd.edu   NeXT mail accepted

             reply	other threads:[~1993-04-10 19:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-04-10 19:52 Alex Blakemore [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-04-12 18:38 and then Charles H. Sampson
1993-04-12 13:29 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!noc.n
1993-04-11  3:55 Michael Feldman
1993-04-10 15:43 Dik T. Winter
1993-04-10 15:36 Dik T. Winter
1993-04-10  9:39 munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!usenet
1993-04-10  1:03 Charles H. Sampson
1993-04-09 18:08 Dave Bashford
1993-04-09 14:06 Dan Rittersdorf
1993-04-08 22:35 Andrew Dunstan,,2285592,
1993-04-08 22:28 Alex Blakemore
1993-04-08 19:03 Art Duncan
1993-04-08 16:18 Charles H. Sampson
1993-04-08 15:34 Christopher J. Henrich
1993-04-08 12:21 enterpoop.mit.edu!usc!cs.utexas.edu!mars.tsd.arlut.utexas.edu!gardner
1993-04-07 22:58 Mark Lundquist
1993-04-07 21:07 Ray Harwood -- Data Basix: (602)721-1988
1993-04-07 16:21 Charles H. Sampson
1993-04-07 12:42 Robert Firth
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox