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



David FOXWELL wrote:
PGM2 is doing this :

MyPtr = %addr(MyDS);
After populating MyDS.

I think what you and Scott are saying is that %addr is also allocating the space.

No. When you define MyDS (without using the BASED keyword), the compiler generates code to reserve memory for that structure when the program is initialized.

%addr() just requests the address in memory that is reserved for that structure.

Normal variables essentially work the same as BASED variables. They need memory allocated to store their values, and they need to be deallocated when no longer needed, so that other programs can use that part of memory. The compiler hides all of the details for you, because most of the time you don't need to worry about them.

As Scott has pointed out, you generally don't need to use pointers in this way unless you are dealing with variably-sized structures or certain objects like User Spaces.

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.