[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (OT) Re: memory management



Keith Lucas wrote:

> OK, it's lightweight but it's not actually that useful. You might as well
> have the containers use void* pointers for all the benefit you get - the
> run-time dynamic casting will still tell you if it's a valid pointer to a
> Object:foo:bar:wibble:concrete:myclass or not.

Well, I like an array of Object* more than an array of void* because of
the easy management: just "delete" them, and they'll do the right thing.
Already, that's a big cloud of memory leaks puffing away...

> It could at least support creation by string name... but then it starts
> getting heavyweight again.

I put that creational stuff in other places, not in the root object.

> >(damn C++, why isn't "virtual" the friggin' DEFAULT???).
> 
> I agree. It should be. Certainly in classes. I could see a point for it not
> being in structures - same as they have different visibility defaults.

Structs could not exist, I wouldn't worry.

For the uninformed, in C++, "struct" and "class" is almost exactly the
same: struct default protection is "public", while class default
protection is "private", other than that, they're the same. C
programmers are often deeply disturbed by this kind of stuff:

class Foo {
  [...]
};

class Bar {
  [...]
};

struct Foobar: public Foo, public Bar {
  [...]
};

class Foobaz: public Foobar {
};

-- 
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi