|
Tom Liotta wrote: > > 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. Tom, as long as you -always- pass the address of a varying length field, and the called procedure expects a pointer to a varying length field, everything would work fine. But if you sometimes pass the address of a fixed-length field, and sometimes a varying-length field, the called procedure wouldn't know what to expect. Unless you add an extra parameter to indicate the type. If you pass a pointer, and decide you're only going to allow the address of one type to be passed, you'll have to enforce this through documentation and knuckle-rapping. The compiler won't help you. But if you're only going to allow one type to be passed, just prototype it as that type and let the compiler help you. Barbara
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.