🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #2017

Re: Should I learn C or C++ first?

#2017
From: Rainer Deyke
Date: Mon, 28 Aug 1995 23:28
30 lines
1859 bytes
Pete Becker (pete@borland.com) wrote:
: In article <41kici$p4t@deyke3.fc.hp.com>, rainer@deyke3.fc.hp.com says...
: >: TApplication* MyApp;
: >: MyApp = new TApplication("My Application");
: >
: >: without new and delete?
: >
: >Why bother with doing both at the same time?
: >
: >MyApp = (TApplication *)malloc(sizeof(TApplication));
: >create_TApplication(MyApp, "My Application");

: The difference is in the gap between the two lines, where you have something 
: that claims to be a pointer to a TApplication object, but isn't. C++ makes it 
: very hard to perform operations on objects that have not been initialized. 
: Separating memory allocation from initalization makes it much easier to 
: accidentally do things like this, as we have all done at one time or another.

Real programmers don't "accidentally" forget to initialize objects.

: 	Or, to turn the question around the other way, why separate them?

Obviously when using an array where each object is initialized to a
different value.  Especially a resizable array.

--
+----------------------------------------------+
|    Rainer Deyke (rainer@mdddhd.fc.hp.com)    |
| "The Earth shall inherit the meek" - Carcass |
+----------------------------------------------+
Technical Details
Message-ID: <41tjep$2hn@deyke3.fc.hp.com>
Path: arc1-ca.pugleaf.net!fc.hp.com!hpfcmdd!deyke3!rainer
References: <DDJ2Lp.3DG@pentagon-ai.army.mil> <41afe9$d10@newsbf02.news.aol.com> <41kici$p4t@deyke3.fc.hp.com> <41ngln$qau@druid.borland.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fc.hp.com!hpfcmdd!deyke3!rainer
From: rainer@deyke3.fc.hp.com (Rainer Deyke)
Newsgroups: rec.games.programmer,comp.lang.c++
Subject: Re: Should I learn C or C++ first?
Followup-To: rec.games.programmer,comp.lang.c++
Date: 28 Aug 1995 23:28:25 GMT
Organization: my basement
Message-ID: <41tjep$2hn@deyke3.fc.hp.com>
References: <DDJ2Lp.3DG@pentagon-ai.army.mil> <41afe9$d10@newsbf02.news.aol.com> <41kici$p4t@deyke3.fc.hp.com> <41ngln$qau@druid.borland.com>
Reply-To: rainer@mdddhd.fc.hp.com
NNTP-Posting-Host: deyke3.fc.hp.com
X-Newsreader: TIN [version 1.2 051093BETA PL3]