comp.lang.ada
 help / color / mirror / Atom feed
* Re: Question regarding LRM 5.95 7.6(19)
       [not found] ` <3fgik5$1fn0@watnews1.watson.ibm.com>
@ 1995-01-18 18:59   ` R. William Beckwith
  1995-01-20  0:44     ` Cyrille Comar
  0 siblings, 1 reply; 4+ messages in thread
From: R. William Beckwith @ 1995-01-18 18:59 UTC (permalink / raw)


Norman H. Cohen (ncohen@watson.ibm.com) wrote:
: their presence too.

: For the programmer, this means that you should not count on exotic side
: effects that depend on Finalize and Adjust being invoked some precise
: number of times.  Normal uses of Finalize and Adjust will work normally,
: however, even in the presence of optimizations.

I was under the impression that any object that is initialize'd or
adjust'ed _will_ always get finalize'd.  However, some objects may
(potentially) get finalize'd more than once and/or get finalize'd
without ever being initialize'd or adjust'ed.
 
I have reference counting that depends on this behavior.
Am I safe? Lawyers?  Compiler writers?
  
... Bill




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question regarding LRM 5.95 7.6(19)
  1995-01-18 18:59   ` Question regarding LRM 5.95 7.6(19) R. William Beckwith
@ 1995-01-20  0:44     ` Cyrille Comar
  1995-01-21 17:35       ` Tucker Taft
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrille Comar @ 1995-01-20  0:44 UTC (permalink / raw)


beckwb@ois.com (R. William Beckwith) writes:
: Norman H. Cohen (ncohen@watson.ibm.com) wrote:
: : their presence too.
: 
: I was under the impression that any object that is initialize'd or
: adjust'ed _will_ always get finalize'd.  However, some objects may
: (potentially) get finalize'd more than once and/or get finalize'd
: without ever being initialize'd or adjust'ed.
:  
: I have reference counting that depends on this behavior.
: Am I safe? Lawyers?  Compiler writers?
:   
if your assumption is 
     nb_init + nb_adjust <= nb_finalize
you are safe from the compiler generated code point of view, but
beware of sneaky users that would call directly Initialize (those
operations better not be visible to the end programmer...)

if your assumption is
     nb_init + nb_adjust = nb_finalize
you are safe in the limited case only. As a matter of fact, in the
non-limited case:

  My_Ctrl_Obj : My_Ctrl_Type := (Controlled with ....);

will not generate a call to Initialize not Adjust (or if it does, in
case an anonymous object is generated, then the anon must be finalized
do there is still one more finalization)

I must say that I have been very surprized to find out that a
controlled object could be neither initialized nor adjusted...
Cyrille
-- 
------------------------------------------------------------------------
Cyrille Comar,                                  E-mail: comar@cs.nyu.edu
Gnat Project                                    US phone: (212) 998-3489




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question regarding LRM 5.95 7.6(19)
  1995-01-20  0:44     ` Cyrille Comar
@ 1995-01-21 17:35       ` Tucker Taft
  1995-01-23 10:45         ` Robb Nebbe
  0 siblings, 1 reply; 4+ messages in thread
From: Tucker Taft @ 1995-01-21 17:35 UTC (permalink / raw)


In article <3fn115$66n@lang8.cs.nyu.edu>,
Cyrille Comar <comar@cs.nyu.edu> wrote:

>... As a matter of fact, in the
>non-limited case:
>
>  My_Ctrl_Obj : My_Ctrl_Type := (Controlled with ....);
>
>will not generate a call to Initialize not Adjust (or if it does, in
>case an anonymous object is generated, then the anon must be finalized
>do there is still one more finalization)
>
>I must say that I have been very surprized to find out that a
>controlled object could be neither initialized nor adjusted...

Initialize is for default initialization.  An aggregate is
for explicit initialization.  If you use an aggregate to initialize
a controlled object, you must give the exact value you want in memory
(e.g., reference count initialized to one, or whatever).

>Cyrille Comar,                                  E-mail: comar@cs.nyu.edu
>Gnat Project                                    US phone: (212) 998-3489

-Tucker Taft   stt@inmet.com
Intermetrics, Inc.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question regarding LRM 5.95 7.6(19)
  1995-01-21 17:35       ` Tucker Taft
@ 1995-01-23 10:45         ` Robb Nebbe
  0 siblings, 0 replies; 4+ messages in thread
From: Robb Nebbe @ 1995-01-23 10:45 UTC (permalink / raw)


In article <D2rnJF.BIw@inmet.camb.inmet.com>, stt@henning.camb.inmet.com (Tucker Taft) writes:

|> 
|> Initialize is for default initialization.  An aggregate is
|> for explicit initialization.  If you use an aggregate to initialize
|> a controlled object, you must give the exact value you want in memory
|> (e.g., reference count initialized to one, or whatever).
|> 

I would like to point out that this is very very handy when you are
implementing a type. The initialize, adjust and finalize procedures
would just tend to get in the way for the implementor. Where they
are needed is for the client who doesn't want to know about them.

Robb Nebbe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-01-23 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <leschkes.790279202@ferret>
     [not found] ` <3fgik5$1fn0@watnews1.watson.ibm.com>
1995-01-18 18:59   ` Question regarding LRM 5.95 7.6(19) R. William Beckwith
1995-01-20  0:44     ` Cyrille Comar
1995-01-21 17:35       ` Tucker Taft
1995-01-23 10:45         ` Robb Nebbe

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