[futurebasic] Re: [FB] Odd Parameter Syntax

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2009 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Fri, 20 Mar 2009 09:01:16 -0700
On Mar 20, 2009, at 7:47 AM, Robert Covington wrote:
>
> That confuses me as written.
Yes, my example and English could have been better. I was in a hurry  
at the time written.

>
> I was under the impression, and with functioning code to support  
> it,  that if you pass a pointer to a function expecting a pointer  
> param, and then send it along to another function expecting a  
> pointer to the same record -type-, you are fine to just pass along  
> again the pointer from the function, and don't need the #, since the  
> param defines the pointer as a pointer to the something?
>
> I know that some toolbox calls do not like an incoming Local Fn   
> pointer param on occasion, and in that case, you need to add the  
> handy = or #, which in effect, sends them the goods, rather than the  
> address of the goods.
>
Yes, your understanding is correct. Also, I believe FBtoC is smarter  
about knowing when it already has a pointer and doesn't try to pass  
the wrong address. Using the '#' in these circumstances is superfluous  
but doesn't hurt anything.



> Fn RectMyBankAccount(@r) // (don't even have to add the @ usually)
Rect tends to be a special case but generally a record structure  
cannot be passed by value and must be passed by reference ( i.e.  
address ). FB4 would automatically pass the address where required  
even when the '@' wasn't used. FBtoC also has ( I believe ) this same  
capability. Personally, I *always* code the @ because: 1) it makes it  
clear to me an address of an object is being passed 2) it doesn't rely  
on a compiler's default behavior and always requests what is needed   
3) Reduces reliance on my memory( or what passes for memory )  of what  
FBtoC does vs. FB.


Brian S