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>
|