|
Carel Teijgeler wrote: > > -- > Mark, > > I think passing arrays to procedures should be treated similar as passing > datastructures to a procedure: that can only be done with based-on > pointers, AFAIK. > Carel, if you pass arrays to procedures by reference or CONST, there is an implicit based-on pointer. There's no need to mess around with explicit pointers. But there's no particular restriction on arrays by value, nor on returning arrays. It may be less efficient to do this because of the extra copying involved in passing by value or returning values, but it's not wrong, and the compiler can handle it. Regarding passing data structures by passing a pointer, that was one way of getting around the problem that the compiler wouldn't treat a prototyped parameter as a data structure. That problem has been removed in V5R1 with LIKEDS, so now you can pass data structures directly to procedures. (It's still more efficient to pass them by reference or CONST though.)
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.