This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ PATCH: operator delete[]


Since I started this whole thing:

  - I seem to remember the question about operator delete being called
    with a null pointer having been raised in comp.std.c++ a long time
    ago.  And that the conclusion was that any replacement function
    must do the right thing.

  - I don't really understand this 'at minimum' business.  The function
    must do *exact* what the standard requires, and no more.  Within the
    limits of the as if rule -- logging all deletes is legal, for example,
    since a conforming program cannot tell that they are being logged.

    In this regard, my debugging operator new/operator delete would be
    conforming as well.  As long as the program doesn't do anything
    involving undefined behavior, it functions exactly as a (very
    inefficient) operator delete should.  (You have to ask it to check
    for memory leaks, and that involves invoking a function not defined
    by the standard.)

    As long as the system operator delete[] invokes operator delete to
    actually free the memory, and doesn't modify any other accessible
    program state, it is legal.  The rest is just a quality of implementation
    issue.

--
James Kanze

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]