|
Barbara: Can you clarify one thing? What do you mean by "which would not work" when you speak about a pointer for a varying length field? Is that to mean such an address cannot be passed? or that the called procedure could not correctly return a value without messing things up in the calling procedure? Would that still be strictly true even if both caller and callee used an agreed length, e.g., the caller set the length appropriately before the call? I've never looked at what would happen for a varying length field in this case; this makes me curious. Thanks. Tom Liotta rpg400-l-request@midrange.com wrote: > 1. Re: Prototypes and parameters (Barbara Morris) > >Tom Liotta wrote: >> >> When you prototype lookup() in the calling procedure, declare a pointer b= >y value for the second parm. When you call lookup(), pass %addr(terms_code)= > or %addr(sh_state). Inside lookup(), you _could_ declare the second parm a= >s q_alpha_10 10A by reference if you really wish or you can again declare a= > pointer and use it as a basing pointer for perhaps q_alpha_10. Just be sur= >e you never use more than the maximum left-most positions of q_alpha_10 tha= >n are indicated by FORMAT. >> > >The trouble with passing a pointer is that it would be possible to pass >the address of a varying length field, which would not work. The >compiler doesn't know that the pointer is supposed to point to a >fixed-length character field. > >I would define the output parameter as character options(*varsize). >There's still no protection against passing say a char(2) where the >format indicates a char(3), but the pointer wouldn't help that case >either. -- Tom Liotta The PowerTech Group, Inc. 19426 68th Avenue South Kent, WA 98032 Phone 253-872-7788 x313 Fax 253-872-7904 http://www.powertechgroup.com __________________________________________________________________ The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
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.