On 12 September 2010 09:16, James Paige <[email protected]> wrote: > On Sat, Sep 11, 2010 at 05:06:22PM -0400, Mike Caron wrote: >> On 9/11/2010 4:27 PM, James Paige wrote: >>> I keep forgetting about BYREF. I know when to use it on ints, and I know >>> never to use it on strings, and I know it is utterly and completely >>> irrelvant on arrays >>> >>> But what I can't remember is whether it matters for UDTs >> >> You generally want to pass UDTs BYREF, especially if you want to modify >> the UDT in the sub. You can pass them BYVAL, but: >> >> 1. They will be read only (it passes a copy) >> 2. If the UDT is big and passed around frequently, it will be >> considerably slower than passing BYREF. > > But doesn't -lang deprecated pass them BYREF by default or something? > > That would explain why all the many times I have forgotten to specify > BYREF on UDTs has not broken anything (that I have noticed yet). > > --- > James
UDTs by default are always passed BYREF, in all dialects, so I'd rather we didn't specify BYREF. What I didn't realise was that Option Byval changes UDTs to pass BYVAL by default! Argh! How could the FB devs be so cruel to us! :( On the whole our code will be cleaner if we explicitly pass all UDTs BYREF, declare Option Byval everywhere, and then remove all the explicit BYVAL passing of integers. But I'm a bit less motivated to do so now. _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
