MS DOS overlay programming

Michael B. Brutman mbbrutman-cctalk at
Fri Dec 22 09:07:59 CST 2006

Chuck Guzis wrote:
> On 21 Dec 2006 at 21:08, Michael B. Brutman wrote:
>> No need to fear C++.  It's just C with some extras.
> Not exactly--I've written plenty of C++ and find that the language 
> features are like chocolate--enough is wonderful, too much is 
> nauseating. 
> The uncertainty about libraries and such to me is the issue of memory 
> management--it's sort of hard to have constructors and destructors 
> without some sort of memory manager.  OTOH, C can live just fine with 
> nothing more than a stack.

Well, here you have a basic misunderstanding of how C++ works. 
Constructors and destructors require a little more tracking, but it does 
not require a memory manager.  A constructor runs when an object is 
created, and the destructor runs when it goes out of scope.  If you are 
working with objects on the stack then additional memory management is 
not needed - the compiler generates extra code to call the destructor as 

And that assumes you use destructors.  My objects generally have 
constructors for initialization, but never destructors.  I revert back 
to a more 'C' like technique of having a function that handles cleanup, 
if it's needed.  The best way to avoid forgetting to do cleanup is to 
avoid putting yourself into a situation where cleanup is necessary. :-) 
  Destructors are one way to do that, good design is another.

> Here's where I draw my own (somewhat arbitrary) line--applications-
> type user-mode code is great with C++, particularly if you have your 
> own class libraries all built up.  If you have a memory leak or 
> dangling reference, it'll end up crashing your application, but the 
> system itself will likely keep chugging right along.
> But if I'm going to write a device driver, TSR, or some other bit of 
> SYSTEM code  in a HLL where memory utilization must be predicable and 
> well-behaved, I'll take C, thank you.  

I don't understand again.  I can write C code that is ugly too.  C++ is 
C with some extra syntactic sugar.  If you use dumb functions in C, 
you'll get bad system code too.  This is just the stereotype of object 
oriented languages being bloated/unpredictable, which is not necessarily 

I had a friend at Big Blue who told me he could do OO in RPG, or 
assembler in C++.  The choice was his.

> Just an old fogie speaking, so ignore if you wish.
> Cheers,
> Chuck

More information about the cctalk mailing list