Good News Everybody!
The new search engine is LIVE!
Please report any problems to david (at) midrange.com.
|
Brad Stone wrote: > ... > 3. What if the pointer pointed to a global variable in the > module/service program? > It would also work if the pointer pointed to a static variable in the procedure. Like Scott said, it doesn't matter what storage the _pointer_ is in, but it does matter what storage the pointer is pointing to. It's safe to return a pointer to static storage, and it's safe to return a pointer to storage that you have allocated using dynamic storage allocation (different from the allocation for local variables). Actually, to muddy the waters a bit (a lot?), there's one case where it's not safe to pass back static or dynamically allocated storage: if the call was to a *NEW program, all the storage is deallocated with the activation group when the program returns.
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.