The plus plus

Les Mikesell lesmikesell at gmail.com
Fri Nov 10 21:55:04 UTC 2006


On Fri, 2006-11-10 at 19:48 +0000, Andy Green wrote:
> > I always thought your basic data type in C should be "array of struct" 
> > regardless of the actual elements you plan to use. Otherwise the
> > semantics don't make sense when you start storing things in allocated
> > or shared memory.  You don't need C++ for that - it has been there
> > from the beginning.
> 
> Yes but once you arrive at that concept, after a short while at least 
> two other ideas arrive:
> 
>   - how do I manage init of these structs, allocation of malloc()-ed 
> elements and free()-ing them to avoid leakage?

Carefully, of course, and in ways that let you allocate shared
memory or malloc()'ed as you choose.

> these are inherent, inescapable needs that follow from the creating of a 
> valuable data-structure-and-associated-code.  That's why they bothered 
> to make a C++ grown out of C.  They have been there and done it years 
> ago, Les!

I've just always thought of data and code as very different things
and both likely to contain their own sort of flaws. If you have
a bug in a function library you may be able to work around it.  How
do you deal with a flaw in a class where the only way to access
the data in an object is broken?

-- 
  Les Mikesell
    lesmikesell at gmail.com





More information about the fedora-list mailing list