Re: ATL/COM memory management

From: Arnaud Debaene (adebaene_at_club-internet.fr)
Date: 05/10/04


Date: 10 May 2004 08:17:41 -0700


"Sergei" <sergei@nospam.summertime.mtu-net.ru> wrote in message news:<ueCJ7GDNEHA.2876@TK2MSFTNGP09.phx.gbl>...
> "Simon Trew" <noneofyour@business.guv> wrote in message news:Oz9p3rANEHA.2996@TK2MSFTNGP12.phx.gbl...
> > If you allocate with new then deallocate with delete.
>
> An array must be deallocated with delete []
> Even if allocated with new.
How do you allocate an array with new (not new[]) ?

> >
> > The array should probably be a private member, but actually the issue of
> > visibility (public/private/protected) is not very important when programming
> > for COM, because clients can only see interfaces, anyway.
>
> As important as in other cases of programming with classes.
> It's that Microsoft spoiled the fun with her all-public design of ATL

COM is not about progamming with classes, it is about programming with
interfaces. Thez fact that you use ATL classes under the cover is just
a detail of implementation.
What would be the interest of an interface with private or protected
members?

Now, it could be interesting to have a notion of "friend" interfaces.

Arnaud
MVP - VC



Relevant Pages

  • Re: Cons cell archaic!?
    ... from s-expression or XML or other syntax you keep the bloated array ... For using vectors to emulate lists that ... Allocate 2, move 1 element: ... What do you think of that algorithm? ...
    (comp.lang.lisp)
  • Storing/Retrieving TYPEs with ALLOCATABLE components (TR) (long)
    ... tBrd, including array descriptor of tEn )). ... Without previous DEALLOCATE, the allocate line fails at run time with message ... the fact that I'm loading an invalid descriptor tBrd%tEn from the file... ... status (which is not possible according to Standard, but then BINARY files ...
    (comp.lang.fortran)
  • Re: Storing the size of an array in the structure itself
    ... >> I think every C programmer can relate to the frustrations that malloc ... >> the size of an array must be stored separately to be a nightmare. ... is anything more than just that - a chunk of memory. ... > Otherwise you couldn't tell it how much to allocate. ...
    (comp.lang.c)
  • determining available space for Float32, for instance
    ... I am looking for a way to determine the maxium array size I can allocate ... We do not want a solution that requires recompiling Python, ... agents may be households that choose a new gridcell to live in. ... Each attribute of a dataset has such a 2D array. ...
    (comp.lang.python)
  • Re: output of allocatable array of strings==> blank?
    ... Inside the subroutine, I declare subheader as ... declare the subheader as a BIG_NUMBER of strings array. ... ALLOCATE the array of the right size and pass it, ...
    (comp.lang.fortran)