[Issue 1207] New: Documentation on destructors is confusing
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue May  1 00:10:56 PDT 2007
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=1207
           Summary: Documentation on destructors is confusing
           Product: D
           Version: 1.014
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com
The documentation under class.html#destructors states:
"""
When the garbage collector calls a destructor for an object of a class that has
members that are references to garbage collected objects, those references are
no longer valid. This means that destructors cannot reference sub objects. This
rule does not apply to auto objects or objects deleted with the
DeleteExpression.
"""
This is unclear.  Which "objects" does the last line refer to?  Does it mean
sub-objects?    Does it mean that calling delete on a sub-object in your
destructor is ok?  If it's really saying that it's a bad idea to *ever* refer
to a pointer sub-object in *any* way in a destructor, then I think that fact
should be stated much more clearly in big bold font.  Particularly it should be
crystical clear on whether it's ok to call delete on your sub-objects, since
this is what all C++ programmers do by reflex in their destructors.
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list