From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 10 Apr 93 19:52:36 GMT From: alex@MIMSY.CS.UMD.EDU (Alex Blakemore) Subject: Re: and then Message-ID: <66288@mimsy.umd.edu> List-Id: 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