umake memory


The BIG 4 of C++:

@p 1. Default ctor -- if your class doesn't have a default ctor, it probably isnt' that useful, and/or is poorly designed.

@p 2. Copy ctor -- just say YES to the copy ctor, because the compiler sure will.

@p 3. Virtual dtor -- think your dtor doesn't need to be virtual? Well, don't worry, you can make it virtual later on. After you have hit yourself in the head with a shoe several hundred times for not making it virtual NOW.

@p 4. Operator= -- this is the only one that is here because you yourself are a bit stupid.

@p If you are using a decent reference or smart pointer system, you can legitimately get away without copy ctor and operator= (but if you need one, then you need the other). But, even if you don't have to implement them in code, you have to do it in your head to make sure what the compiler is going to do is right.

@p The memory leaks in umake were due to several factors:

@p 1. Pregenerated phrase::idea structures were much larger than anticipated. Now they are only temporarily generated (for the most part), right before an object is written out.

@p 2. Circular reflinks. I implemented a whole new ref system and retrofit all my classes to use it. Then it didn't work. So i fixed the circular references which really weren't that hard to find and is ultimately just a much more practical reality in C++. I have concluded that C++ probably could do safe garbadge collection in the compiler.

@p 3. See BIG 4, rule #2.

2004-01-13


◀ Back