| |
| Posted by Wu Yongwei | PermalinkReply |
|
Wu Yongwei
| Hi, Walter,
While I believe DMC has improved much in standard conformance, it is always weak in new/delete. I have not been to compile my memory leak detector <URL:http://wyw.dcweb.cn/leakage.htm> under DMC because of this. Specifically it has the following problems:
1) Exception specification in operator new/delete results in an obscure message like:
test.cpp(4) : Error: 'operator new' previously declared as something else
It was declared as: void *C func(unsigned )
It is now declared: void *C func(unsigned )
Even "throw()" cannot be used:
test.cpp(9) : Error: 'operator del' previously declared as something else
It was declared as: void C func(void *)
It is now declared: void C func(void *)
(And 'operator del' does not look better than 'operator delete'.)
2) Placement deallocation functions cannot be declared or defined:
test.cpp(9) : Error: must be void operator delete(void * [,size_t]);
3) `operator new' still defaults to the nothrow mode. (Hey, old code should use old compilers, or define their own global `operator new'. Microsoft's `operator new' does not throw in MSVC 6.0, but it does in MSVC 7.1.)
4) Use of new(nothrow) gives a strange error:
no_ptr = new(nothrow) Obj;
^
test.cpp(15) : Error: no match for function '?2(unsigned ,const std::nothrow_t)'
I really, really hope you can improve on this.
Best regards,
Yongwei
|