Question regarding LRM 5.95 7.6(19) 
Author Message
 Question regarding LRM 5.95 7.6(19)


: their presence too.

: For the programmer, this means that you should not count on {*filter*} 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



Mon, 07 Jul 1997 02:59:07 GMT  
 Question regarding LRM 5.95 7.6(19)


: : 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
--
------------------------------------------------------------------------

Gnat Project                                    US phone: (212) 998-3489



Tue, 08 Jul 1997 08:44:21 GMT  
 Question regarding LRM 5.95 7.6(19)

Quote:

>... 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).

Quote:

>Gnat Project                                    US phone: (212) 998-3489


Intermetrics, Inc.


Thu, 10 Jul 1997 01:35:38 GMT  
 Question regarding LRM 5.95 7.6(19)

|>
|> 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



Fri, 11 Jul 1997 18:45:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Compile-mode for VHDL Compiler for emacs-19.19

2. Celefunt results, g77 0.5.19 vs 0.5.19.1

3. Tcl 7.6 and Solaris 2.6 Question.

4. 7.6 clock scan and Y2k -- quick question

5. Several questions on expect5.19 (looong)

6. FAQ: comp.lang.tcl Frequently Asked Questions (3/5) (Last updated: August 19, 1994)

7. FAQ: comp.lang.tcl Frequently Asked Questions (1/5) (Last updated: October 19, 1993)

8. FAQ: comp.lang.tcl Frequently Asked Questions (4/5) (Last updated: October 19, 1993)

9. diff Ada83-LRM Ada9X-LRM

10. REALBasic in 7.6

11. [ANN} Data Plotting Library DISLIN 7.6

12. Data Plotting Library DISLIN 7.6

 

 
Powered by phpBB® Forum Software