From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2203a21a136b39cc X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Fortran's Equivalence Date: 1997/04/04 Message-ID: #1/1 X-Deja-AN: 230675896 References: <333840D1.7B12@cae.ca> <5hbcdn$i1h@top.mitre.org> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-04-04T00:00:00+00:00 List-Id: Keith said <<1. If you're going to implement overlays using address clauses, it's safer (and can't do any harm) to declare all the overlaid objects as aliased. Pragma Volatile might be even better. Perhaps someone more familiar with this than I am can elaborate (or execute, or evaluate 8-)}).>> There is no particular point in declaring these objects aliased, unless you intend to take their address or take a pointer to them. I suppose there might be some compilers where the use of aliased would make a difference in optimization in the absence of pointers, but you certainly cannot deduce this from the RM (in either informal or pedantic mode). Also aliased may well have the effect of adding additional "dope " information which you may or may not want. Declaring the two variables to be volatile *does* make good sense. This ensures that references always go to memory, and almost certainly must disconnect any optimizations that would defeat the non-pointer based aliasing. Note incidentally one HUGE advantage of overlays over the use of unchecked conversion, which is that if you use uncheckd conversion, you always have to do two of them to make a modification. Consider a case where we want an array of 32-bit integers overlaid by an array of 32-bit floats. Now if you do this by declaring an array of 32-bit floats and then doing unchecked conversion to 32-bit integer, you will end up doing x(J) := To_Float_32 (Fiddle (To_Integer_32 (x(J)))); which is MUCH more more inpenetrable than: x_Int (J) := Fiddle (X_Int (J)); Of course it is always a matter of taste whether you want to emphasize the nature of what you are doing by writing the explicit stuff each time. A legitimate objection to the second form here might be that it is TOO easy to write and read!