× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Lim Hock-Chai wrote:
is there a reason to ever use dealloc without the (n) extender?

I think it's a good idea. If it's at the very end of the procedure where the pointer is defined in automatic storage, or it's just before you seton LR and return, it's not going to make any difference. But someone might come along and add some code after the DEALLOC, or might copy the DEALLOC to some place earlier in the code. Sure, maintenance programmers can always introduce subtle errors, but the kind of errors you get from using deallocated pointers are especially hard to reproduce and debug, so reducing the incidence of that type of problem is A Good Thing, IMO.

Even with DEALLOC(N), there's still a possibility of error. If you do this:
p1 = %alloc(len);
p2 = p1;
dealloc(n) p1;
p2 still points to the deallocated storage.

Think of (N) as a mental trigger to think about whether any other pointer might be pointing to that storage.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.