Re: inhibit compiler warning C4624 for a class hierarchy
- From: changliw@xxxxxxxxxxxxxxxxxxxx (Charles Wang[MSFT])
- Date: Sun, 14 Jan 2007 17:19:17 GMT
Hi rbv,
The undefined behavior means that the behavior is decided by the compiler.
Different compilers may cause different behaviors. C++ standard does not
define a consistent behavior for this situation.
For your four requirements, I am afraid that it is hard to implement unless
you do some changes. Even if you use template allocator/deallocator, your
none-virtual Destroy method is defined in your base class OpNotification
and it uses "delete this". This only release your base instance space,
however if your derived class instance includes additional data members,
this may cause memory leak due to some left spaces not released.
Why do not you use a macro for releasing your object? It might be the least
work in your situation.
For example:
#define __ReleaseB(pB) \
delete pB;\
pB=NULL;
Hope this helps! Please feel free to let us know if you have any other
questions or concerns.
Sincerely yours,
Charles Wang
Microsoft Online Community Support
======================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
.
- Follow-Ups:
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Ben Voigt
- Re: inhibit compiler warning C4624 for a class hierarchy
- References:
- inhibit compiler warning C4624 for a class hierarchy
- From: Ben Voigt
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Alex Blekhman
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Heinz Ozwirk
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Alex Blekhman
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Ben Voigt
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Igor Tandetnik
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Ben Voigt
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Igor Tandetnik
- Re: inhibit compiler warning C4624 for a class hierarchy
- From: Ben Voigt
- inhibit compiler warning C4624 for a class hierarchy
- Prev by Date: Re: c++/cli compiler oddity
- Next by Date: VC++ and DLLS
- Previous by thread: Re: inhibit compiler warning C4624 for a class hierarchy
- Next by thread: Re: inhibit compiler warning C4624 for a class hierarchy
- Index(es):
Relevant Pages
|