Re: Objective-C vs. Java
Re: Objective-C vs. Java
- Subject: Re: Objective-C vs. Java
- From: Kent Sandvik <email@hidden>
- Date: Thu, 26 Jul 2001 10:56:11 -0700
on 7/26/01 7:14 AM, Vladimir Makovsky at email@hidden wrote:
>
I found stack based objects *EXTREMELY USFULL*. It's hard to underestimate
>
automatic clean up of allocated resource or automatic settings restoration.
>
Just makes you code simple and effective - and you *ALWAYS* know when clean
>
up will happen - on out of scope step.
>
One thing when you detect error inside you function call and decide to get
>
out, other thing when you call other functions hierarchy and somewhere down
>
there one of them will throw...
Yep. It' very handy, especially with small utility classes that with the
constructor saves state, does a thing, and the destructor at the end
triggers that the state is restored. Good with graphics programming, for
example.
Also, small objects that are constantly created/deleted makes the heap
fragmented, even with a VM system it's an issue. Placing these in the stack
frame and when deleted eliminates this performance issue, as well. --Kent