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: 29 Sep 92 15:05:27 GMT From: sampson@cod.nosc.mil (Charles H. Sampson) Subject: Re: Using Global Variables Message-ID: <1992Sep29.150527.8737@nosc.mil> List-Id: In article <92269.56792.LJ10891@LMSC5.IS.LMSC.LOCKHEED.COM> LJ10891@LMSC5.IS.LM SC.LOCKHEED.COM writes: >------------------------- Original Article ------------------------- >> With the result that anybody who needs to access anything in shared >>memory now has full access to everything in shared memory. Ah, informa- >>tion hiding, what has happened to you? > > Charli e > > True, but the problem domain under discussion seemed centered around >large memory areas with common access requirements. For a more discriminating , >less refined (yes, I do believe that parameter passing is more refined and >controllable), method one could open the pandora's box of: > >package GLOBAL_1 is ... -- regionals associated with some functionality >package GLOBAL_2 is ... -- regionals associated with another functionality >.. -- etc. > Try the following: PACKAGE BODY Hider IS Shared_datum : ... FOR Shared_datum USE AT A_shared_memory address; ... END Hider; It's possible to engineer the layout of shared memory to some degree when using this approach, but it requires a compiler that has implemented some modest sort of address arithmetic. If speed of access to this datum is a requirement, it can be obtained in most compilers by inlining the access routines. > Synchronization is left as an exercise for the masochist. :-) Synchronization becomes a lot easier because it's all hidden inside this package. Charlie