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



Hi Lim -

If the based pointer already pointed to an allocate memory, shouldn't
you dealloc it first before calling subprocedure that return a pointer?
Otherwise you might cause memory leak (I think).

The compiler checking I'm referring to is more like in the source code
you do something like this: myField_BasePointer = *null;  (from
everybody's posting, seems like you should always do dealloc(n)
myField_BasePoniter)

Not every use of a pointer is for allocated memory. Pointers for a lot of things. The same pointer could be used for several purposes within the same program. (A poor idea but certainly possible). So making the setting of a pointer to *NULL be a fatal compiler error would be a bad idea. Even making the setting of a pointer that used somewhere with ALLOC or %ALLOC would be a bad idea.

OTOH, making the default for DEALLOC to be setting the pointer to *NULL would be okay (at least in my opinion).

Ken
http://www.kensims.net/
Opinions expressed are my own and do not necessarily represent the views of my employer or anyone in their right mind.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.