[futurebasic] Re: [FB] FBtoC problemo

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2011 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Sun, 25 Dec 2011 23:02:33 -0700
On Dec 24, 2011, at 12:15 AM, RC wrote:

>> Local Fn AppFolderNestedFolder(name$, outFS as ^FSSpec)
>> dim as FSSpec appSpec, mySpec
>> dim as OSErr err
>> err = Fn GetApplicationSpec(@appSpec)
>> err = fn FD_CreateDirectoryWithFSSpec( Fn CFStr(name$), appSpec, mySpec )  // Gives warning
>> blockmove @mySpec, outFS, sizeof(FSSpec)
> 
To which Robert P. wrote:

> err = fn FD_CreateDirectoryWithFSSpec( fn CFStr( "" + name$ ), appSpec, #outFS )

This post seems to refer back to Robert’s post:

On Dec 25, 2011, at 6:14 PM, Robert Covington wrote:

> I don't know when to use an @, when to 'dim as something @var'  and when to use # nowadays, and when to use #[ ] nowadays...I wish there was a FAQ. Is there one? 

'dim as type @var' - the '@' is superfluous and ignored in FB5. The compiler( i.e. gcc/clang etc. ) figures out if how vars should be allocated and determines the most efficient method on its own. 

when to use # - also refer to Robert P’s code above. The #outFS says to the translator to just pass outFS and not to take its address ( with the '@' symbol ) because it is already a pointer ( ^FSSpec ). Using #outFS allows the FD_ call to use that pointer to return the FSSpec to the caller of AppFolderNestedFolder() and the blockmove is superfluous.


Brian S