Good News Everybody!
The new search engine is LIVE!
Please report any problems to david (at) 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.
This mailing list archive is Copyright 1997-2026 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.