teittinen@cc.helsinki.fi (01/24/91)
Can I use realloc() to handle pointers created by new-operator? Can this
cause any troubles? I'd like to use new-operator to minimize pointer
type casts and because it does arrays right without sizeof-calculations.
Why is there no resize-operator that would make the same thing as
realloc(), but would return the right pointer type? That way I could get
rid of some pointer type casts (void* -> MyType*).
-- 
E-Mail: teittinen@finuh.bitnet               ! "Studying is the only way
        teittinen@cc.helsinki.fi             !  to do nothing without
Marko Teittinen, student of computer science !  anyone blaming you" -mesteve@taumet.com (Stephen Clamage) (01/26/91)
teittinen@cc.helsinki.fi (Marko Teittinen) writes: >Can I use realloc() to handle pointers created by new-operator? Can this >cause any troubles? I'd like to use new-operator to minimize pointer >type casts and because it does arrays right without sizeof-calculations. >Why is there no resize-operator that would make the same thing as >realloc()... One use of "new" is to allocate an array of simple objects. Another is to allocate space for an object with a constructor. In the latter case, what would be the semantics of a realloc operator? It makes no sense, given strong typing, to extend the size of a single class object. There are possible uses for a realloc operator, but the semantics get a little muddy. -- Steve Clamage, TauMetric Corp, steve@taumet.com