Article View: rec.games.programmer
Article #2039Re: Should I learn C or C++ first?
From: vancleef
Date: Sat, 02 Sep 1995 02:56
Date: Sat, 02 Sep 1995 02:56
56 lines
2734 bytes
2734 bytes
In article <42700d$gmm@deyke3.fc.hp.com>, rainer@deyke3.fc.hp.com (Rainer Deyke) writes: > Darren Walker (dwalker@imtn.dsccc.com) wrote: > : Rainer Deyke (rainer@deyke3.fc.hp.com) wrote: > > : : Obviously when using an array where each object is initialized to a > : : different value. Especially a resizable array. > > : Um, I still think you are missing the point behind new and delete, but you > : are set in your ways, so malloc and remalloc to your hearts content. We > : can't stop you. But I'll attempt one last time anyway... > : In the case of a pointer to a dynamic array, you could simply do (using a > : dynamic array class called dynArray) > > : dynArray* dynamicArray; > : dynamicArray = new dynArray; // call the default or redefined > : // default constructor > : ...then anytime you need to change the array, you can do this... > > : dynamicArray->resizeArray(NEW_SIZE); > > : or... > > : dynamicArray->addElement(ELEMENT); > > : or something like that...you could of course have used malloc instead... > > So how do you implement dynamicArray without realloc? And how can you > have dynamic arrays of any arbitrary element type (dynamic array of > dynamic arrays, dynamic arrays of function pointers, etc.)? > > : the whole point is that you don't HAVE to use new and delete, they are merely > : _convenient_ overloadable operators, just like you may not want to use cout > : or cin for favor of a faster printf or fprintf. But like any feature, unless > : you use it, you have no idea how nice it really is... > > Of course I don't have to use them, and I don't use them. So, is there > any remaining advantage to using C++ (other than inline functions)? > Nope. None. Period. Tell you what, you do your work with C and I'll do mine with C++. -Garrett (If you don't mind my asking, exactly what *do* you do at HP anyway? I'll bet you didn't know that your company produces one of the best C++ compilers out there, you being jusr a C programmer and all... ) > -- > +----------------------------------------------+ > | Rainer Deyke (rainer@mdddhd.fc.hp.com) | > | "The Earth shall inherit the meek" - Carcass | > +----------------------------------------------+
Technical Details
Message-ID:
<1995Sep1.225659.8056@ohstpy>Path:
arc1-ca.pugleaf.net!ohstpy.mps.ohio-state.edu!vancleefReferences:
<DDJ2Lp.3DG@pentagon-ai.army.mil> <42700d$gmm@deyke3.fc.hp.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ohstpy.mps.ohio-state.edu!vancleef From: vancleef@ohstpy.mps.ohio-state.edu Newsgroups: rec.games.programmer,comp.lang.c++ Subject: Re: Should I learn C or C++ first? Message-ID: <1995Sep1.225659.8056@ohstpy> Date: 1 Sep 95 22:56:59 -0400 References: <DDJ2Lp.3DG@pentagon-ai.army.mil> <42700d$gmm@deyke3.fc.hp.com> Followup-To: rec.games.programmer,comp.lang.c++ Organization: The Ohio State University, Department of Physics