Re: C++ Runtime Binding

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 03/16/04


Date: Mon, 15 Mar 2004 17:19:28 -0800

I believe you are under the misconception that constructors and
destructors are called by new and delete from the CRT, whereas
in fact they are not - they are inserted by the compiler, while
new/delete merely allocate/deallocate the memory.

Notice Igor carefully referred to global/static objects' constructors/
destructors only, since these are the only ones affected in ATL3.

-- 
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Ben Rush" <kwendex@yahoo.com> wrote in message news:%23MSS0suCEHA.2888@TK2MSFTNGP09.phx.gbl...
> Okay, thanks Igor.
> 
> So to summarize, one can pretty much use new and delete throughout ATL w/out
> noticing any ill effects; things are done for us under the hood to make us
> feel, at least with new and delete, that we are fully bound to the C++
> runtime.
> 
> Thanks,
> Ben
> 
> 
> "Igor Tandetnik" <itandetnik@mvps.org> wrote in message
> news:uogyGytCEHA.1544@TK2MSFTNGP09.phx.gbl...
> > "Ben Rush" <kwendex@yahoo.com> wrote in message
> > news:%23x0F%23ctCEHA.3928@TK2MSFTNGP09.phx.gbl...
> > > I guess what I should have asked is how are the constructors and
> > destructors
> > > called without the CRT? My understanding, and it could be quite easily
> > > flawed, is that without the startup code for the runtime, constructors
> > and
> > > destructors aren't called. But if they can be called in a _ATL_MIN_CRT
> > > build, then something has to be doing the leg work.
> >
> > ATL7 essentially replicates the necessary start-up code - just enough of
> > it to run constructors and destructors of global objects.
> > -- 
> > With best wishes,
> >     Igor Tandetnik
> >
> > "For every complex problem, there is a solution that is simple, neat,
> > and wrong." H.L. Mencken
> >
> >
> 
> 
> 


Relevant Pages

  • Re: C++ Runtime Binding
    ... What you're saying is that when the CRT is linked, ... that calls the constructors and destructors of global/static objects. ... Notice Igor carefully referred to global/static objects' constructors/ ...
    (microsoft.public.vc.atl)
  • Re: C++ Runtime Binding
    ... > that calls the constructors and destructors of global/static objects. ... calls to constructors and destructors are emitted at compile time ... The start-up code (be it in CRT or ATL7) simply ...
    (microsoft.public.vc.atl)
  • Re: C++ Runtime Binding
    ... I guess what I should have asked is how are the constructors and destructors ... called without the CRT? ... My understanding, and it could be quite easily ...
    (microsoft.public.vc.atl)
  • Re: C++ Runtime Binding
    ... > called without the CRT? ... > flawed, is that without the startup code for the runtime, constructors ... ATL7 essentially replicates the necessary start-up code - just enough of ... it to run constructors and destructors of global objects. ...
    (microsoft.public.vc.atl)
  • Re: advantages of C
    ... And constructors and destructors and templates and exceptions and ...
    (comp.programming)