|
The way you describe ALLOC and DEALLOC is pretty much an industry standard from what I've seen and so wouldn't, IMO, be considered "quirky" in RPG unless you consider them quirky in all languages. > - ALLOC doesn't provide an option to initialize the storage during > allocation. This makes for some interesting bugs if the programmer reads > back more data than he wrote to the heap. True. No alloc I've seen does this, although I'm kinda hazy on Basic's implementations. Easy enough to write a wrapper around RPGs ALLOC for this though to initialize the data without having to code an MI ALLOC. > - DEALLOC forces you to remember to add the (N) opcode extender in order to > automatically set the pointer to NULL. At the very least, shouldn't this > have been the default? After all, why would you let a programmer maintain a > valid pointer to heap storage that you've just freed? Maybe there's a good > reason for it, but I've yet to run across it. DEALLOC has an (N) extender? Nice. C/C++ doesn't have anything like that far as I know. I have to set it to NULL myself. > - Error reporting is very primitive. Status 426 - error in storage > management operation, is not exactly informative. About the only real error I know of with ALLOC is not enough memory to alloc what I want. Nothing else even comes to mind. With DEALLOC the only error I know of is that the pointer given is not a pointer to ALLOCed memory. Regards, Jim Langston
As an Amazon Associate we earn from qualifying purchases.
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.