realbasic-nug
[Top] [All Lists]

Re: "You're not going to learn how to program in BASIC any more"

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: "You're not going to learn how to program in BASIC any more"
From: Alex Lindsay <alindsay at mac dot com>
Date: Fri, 30 Sep 2005 12:01:36 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20050930142614 dot C65A0DDD465 at lists dot realsoftware dot com> <433D5E28 dot 1090302 at wanadoo dot fr> <70af859d6b5bbb44e39f618e4646a05a at mac dot com> <D12CC48E-26B5-454F-9882-482ECC9BF037 at haranbanjo dot com>
As always whipping an example off is an mistake. :) I am fully aware of the differences in memory as I have use C++ professionally daily for 17 years :)

how about this.

int arrayInt[10];

int * intPtr = arrayInt;  OR int * intPtr = arrayInt[0];

Now you continue with my overall points, and please ignore any discrepencies in my (stupid) examples. The point is now the two items are logically different, a pointer to an int or an array of ints

Better?

Or even worse:

int *intPtr = (int*) &SomethingNotAnInt;



Thank you,

Alex Lindsay
On Sep 30, 2005, at 11:41 AM, Will Leshner wrote:


On Sep 30, 2005, at 9:32 AM, Alex Lindsay wrote:

int array[10];

is the same as

int *array = new int[10];


Actually, those two aren't the same. One has its memory on the stack while the other has its memory in the heap. That's an important distinction because with the former you don't have to worry about freeing memory, but with the later, you do.

--
REALbasic news and tips: http://rbgazette.com
KidzMail & KidzLog: http://haranbanjo.com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>