On Mar 20, 2009, at 10:28 AM, Brian Stevens wrote: > > On Mar 19, 2009, at 8:49 PM, Max Taylor wrote: >>> >>> In FBtoC, '=' is a synonym for '#' when either appears in front >>> of a function argument. They both mean "evaluate the argument as >>> an expression and pass its value, even if the called function's >>> declaration would otherwise require the address of a variable to >>> be obtained and passed". > > One situation where this occurs is passing pointers ( say to a > record structure ) to functions. Within the called function that > receives the pointer, it might call another function that also > requires a pointer to that same record structure. This second call > would use a '#' before the record structure name to pass it "as > is". Without the '#' an attempt would be made to generate the > address to the record but this would be wrong because it already > contains a pointer to the record. > > > > local fn ProcessIt ( aRecPtr as ^someRec ) > end fn > > > local fn test ( theRecPtr as ^someRec ) > > fn ProcessIt( #someRec ) // receiver wants pointer to record, so > pass as is since it is already a pointer. > > end fn > > dim as someRec myRec > > fn test ( @myRec ) > > > > Brian S That confuses me as 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. Robert Local Fn HannibalRector(r as ^rect) print r.right end fn Local Fn RectMyBankAccount(r as ^rect) Fn HannibalRector(r) end fn dim r as rect setRect(r,0,0,32,32) window 1 Fn RectMyBankAccount(@r) // (don't even have to add the @ usually) do handleEvents until gFBQuit //same with a record... begin globals Begin record SomeRec dim r as rect dim u as int dim sure as long end record end globals Local Fn HannibalRector(r as ^SomeRec) print r.r.right // you see 32. end fn Local Fn RectMyBankAccount(r as ^SomeRec) Fn HannibalRector(r) end fn dim r as SomeRec setRect(r.r,0,0,32,32) window 1 Fn RectMyBankAccount(@r) // (don't even have to add the @ usually) do handleEvents until gFBQuit