[futurebasic] Re: [FB] C++ Operator?

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

From: Rick Brown <rbrown@...>
Date: Mon, 28 Dec 1998 20:50:41 -0600
John wrote:

> Does anyone know what "->" translates to, as in the following...
> 
> if (curdebt -> db.mortgage) {...etc.

It means that curdebt is a pointer to a record (they call a record a
"struct" in C).  That record contains a field called "db", which itself
is a littler record which contains a field called "mortgage".

If curdebt were a record ("struct") variable, rather than a pointer
variable, then the C code would look like this:

  curdebt.db.mortgage

But you have to use the special symbol "->" in cases where the variable
is a pointer variable rather than a record variable.

In FB, you can always tell the difference between a pointer variable and
a record variable, because pointer variables always end with "&", and
record variables never have a suffix.  So FB doesn't need to invent a
special symbol like "->".  To get the same effect in FB (where curdebt&
is a pointer to a record), you'd do this:

  curdebt&.db.mortgage

(You might also have to stick some suffix character on the end of
"mortgage", depending on what its data type is supposed to be).

- Rick