[futurebasic] Re: [FB] Pointers, Handles, and odd characters in FB^3

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2001 : Group Archive : Group : All Groups

From: Heather Donahue <heatherd@...>
Date: Sat, 10 Feb 2001 20:27:29 -0800
At 8:19 PM -0500 on 2/10/01, Michael S Kluskens wrote:

>The following are not explained in the manuals as near as I can tell 
>(listed yes but not explained)
>
>@@
>^^
>..  (that's two periods)

Both of these are explained in the reference manual under #Define and 
the DIM statement.  They are all synonyms for Handle To as in:

DIM myVar AS Handle TO Long
DIM myVar AS @@Long
DIM myVar AS ..Long

All work the same.

[SNIP Stuff I'll leave to others]

>Then there is "@b", is that a pointer to the variable "b"

Yes, '@b' is the same as the VarPtr statement.

>Now for a C conversion question:
>
>   h1 = GetPicture(Num);
>   HNoPurge((Handle)h1);
>
>Apparently "(Handle)h1" converts "h1" into handle (or maybe not, I'm 
>guessing)?  Any suggestions as to what to do with this (ignore 
>it/drop it?).

That's called typecasting and FB^3 doesn't use it, you'll have to 
remove that since FB^3 won't like it.  Basically, C compilers are a 
little stupid.  GetPicture returns a PicHandle, we all know that it 
is really a Handle.  PicHandle though, is defined as a Pointer to 
PicPtr.  PicPtr is defined as a Pointer to Picture.  Picture is a 
record structure.

So a C compiler would think that a PicHandle is really a Pointer to a 
Pointer and not a Handle.  The compiler thinks they aren't the same. 
Typecasting is used to force the compiler to treat one variable type 
as if it is another.

-- 
Heather Donahue
-- non sum qualis eram