comp.lang.ada
 help / color / mirror / Atom feed
From: orville@weyrich.UUCP (Orville R. Weyrich)
Subject: Re: Types defining h/w r/o or w/o registers
Date: 3 Jun 91 07:57:41 GMT	[thread overview]
Message-ID: <1991Jun3.075741.1945@weyrich.UUCP> (raw)
In-Reply-To: 1991Jun2.095459.1@east.pima.edu

In article <1991Jun2.095459.1@east.pima.edu> rharwood@east.pima.edu writes:
>In article <3949@titan.tsd.arlut.utexas.edu>,
>gardner@titan.tsd.arlut.utexas.edu (Don Gardner) writes:
>
>> Is there some way to define a type such that all variables of that
>> type can be only read or only written?  For instance, I have a type that
>> defines the status register of some peripheral which can only be 
>> read.  It would be best if the compiler could flag any assignments 
>> to variables of such a type as errors.
>> 
>> Is there some other means for commonly handling this problem?  The 
>> compiler being used is VADSWorks, if an implementation-defined solution
>> is required.
>
>Well, it's been 2.5 years since I did this, but IMHO "the right way" to do what
>you are trying is to encapsulate the READ operation in a FUNCTION and the WRITE
>operation in a one-parameter procedure.  Several replies to your message


I have one concern about this approach: What happens if the compiler optimizer
is SO CLEVER that it notices a write to a location that is never referenced,
and optimizes away the write? 

Does anyone know of a compiler that is this clever?

In any event, you had best check the machine language generated each time
your compiler is upgraded ...

Is there any issue pending before the 9x committee to address the issue of
declaring certain memory locations as VOLATILE?

--------------------------------------           ******************************
Orville R. Weyrich, Jr., Ph.D.                   Certified Systems Professional
Internet: orville%weyrich@uunet.uu.net             Weyrich Computer Consulting
Voice:    (602) 391-0821                         POB 5782, Scottsdale, AZ 85261
Fax:      (602) 391-0023                              (Yes! I'm available)
--------------------------------------           ******************************

  reply	other threads:[~1991-06-03  7:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-05-30 13:03 Types defining h/w r/o or w/o registers Don Gardner
1991-05-31 17:03 ` david.c.willett
1991-05-31 17:10   ` david.c.willett
1991-05-31 17:26 ` J o s e D u a r t e
1991-06-01  8:34   ` Orville R. Weyrich
1991-06-01 10:01 ` Types defining h/w r/o or w/o regis stt
1991-06-02 16:54 ` Types defining h/w r/o or w/o registers rharwood
1991-06-03  7:57   ` Orville R. Weyrich [this message]
1991-06-04 14:08     ` John Goodenough
1991-06-04 14:48     ` Anthony Shipman
1991-06-05 13:59       ` John Goodenough
  -- strict thread matches above, loose matches on Subject: below --
1991-06-05 18:59 John Goodenough
1991-06-06  3:02 Steven V. Case
1991-06-09  0:15 ` rharwood
replies disabled

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