BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

operator new

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Ellis
Guest





PostPosted: Wed Dec 10, 2003 11:24 pm    Post subject: operator new Reply with quote



Hi :)

How can i override the operator new of a form that inherits from TForm ?
TForm::operator new() ...

Ellis


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Dec 10, 2003 11:32 pm    Post subject: Re: operator new Reply with quote




"Ellis" <ellis.antaya (AT) integratik (DOT) qc.ca> wrote


Quote:
How can i override the operator new of a form that inherits
from TForm ? TForm::operator new() ...

Why do you need this exactly? The VCL has its own memory manager, and
expects as much. Overriding the 'new' operator is most commonly done to
provide custom memory management, which I do not recommend you do for VCL
objects.


Gambit



Back to top
Ellis
Guest





PostPosted: Fri Dec 12, 2003 7:13 pm    Post subject: Re: operator new Reply with quote



Quote:
How can i override the operator new of a form that inherits
from TForm ? TForm::operator new() ...

Why do you need this exactly? The VCL has its own memory manager, and
expects as much. Overriding the 'new' operator is most commonly done to
provide custom memory management,
That's what i want to do Smile


Quote:
which I do not recommend you do for VCL objects.
Why not ?


Ellis



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Dec 12, 2003 8:59 pm    Post subject: Re: operator new Reply with quote


"Ellis" <ellis.antaya (AT) integratik (DOT) qc.ca> wrote


Quote:
Why not ?

Because the VCL is written in Delphi, not C++, and as such plays by Delphi
rules. The VCL does not use the 'new' (and 'delete') operators to begin
with, because they are C++ operators, they do not exist in Delphi. The VCL
has its own memory management system that should be used instead. If you
must provide your own memory management for the VCL, then have a look at the
SetMemoryManager() function.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.