-
Enhancement
-
Resolution: Fixed
-
P4
-
22
-
b14
The class AdaptivePaddedAverage has two overloads for operator new.
The first is equivalent to `::operator new(size_t, void*)`, i.e. global placement new. This one is unused. It has existed since before the mercurial age. It can (and should) be removed.
The second, `operator new(size_t)`, just forwards to `CHeapObj` with the same memflags as used by the base class. It exists only to provide "normal" allocation because the derived `CHeapObj` function is shadowed by the first overload. (A simplier implementation would have been a `using` directive to bring the base class function into scope.) Removing the first overload makes this one unnecessary.
Note that `AdaptivePaddedAverage` doesn't have any corresponding `operator delete`, simply using the one from the base class. There is a gcc warning option (-Wmismatched-new-delete) that I think should complain about this, except I think the classes involved are never deleted.
The first is equivalent to `::operator new(size_t, void*)`, i.e. global placement new. This one is unused. It has existed since before the mercurial age. It can (and should) be removed.
The second, `operator new(size_t)`, just forwards to `CHeapObj` with the same memflags as used by the base class. It exists only to provide "normal" allocation because the derived `CHeapObj` function is shadowed by the first overload. (A simplier implementation would have been a `using` directive to bring the base class function into scope.) Removing the first overload makes this one unnecessary.
Note that `AdaptivePaddedAverage` doesn't have any corresponding `operator delete`, simply using the one from the base class. There is a gcc warning option (-Wmismatched-new-delete) that I think should complain about this, except I think the classes involved are never deleted.