RE: [Dev-C++] dynamic allocation and structs
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2002-10-25 15:45:45
|
Either store void pointers in the array, or always typecast each array assignment to a "base-class" struct. Since C doesn't have any RTTI, the simplest way to afterwards find out about the contents of the pointer, is to assure that all used structs always starts with a field type, that may be checked, before typecasting the pointer to the correct type and do any real actions. /Per W On Fri, 25 Oct 2002, Ioannis Vranos wrote: > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Friday, October 25, 2002 1:54 PM > > To: Ioannis Vranos > > Cc: Dev-C++ Mailing List > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > Exactly why my previous mail specified use-cases. > > > > - Sparse matrix, where a lot of entries are NULL. > > - Quick sort, since it's enough to move the pointers. > > - Different object types for each index, simulating C++ abstract base > > class. > > > You need void * for this (or a container struct). But this means you > can't use it directly. > > > > - Supports large vector in 16-bit code, where it's possible > > to have 16000 > > entries of up to 64000 byte size each. > > > Yep, you are an older programmer than me. :) I know the 64 KB DOS limit > though. > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |