MAINSAIL Language Manual, Section 32.80

previous   next   top   contents   index   framed top   this page unframed


32.80. cva

Figure 32–79. cva (GENERIC)
$BUILTIN
ADDRESS
PROCEDURE   cva         (POINTER p);

$BUILTIN
ADDRESS
PROCEDURE   cva         (CHARADR c);

$BUILTIN
ADDRESS
PROCEDURE   cva         (LONG INTEGER l);

$BUILTIN
ADDRESS
PROCEDURE   cva         (LONG BITS b);

$BUILTIN COMPILETIME
ADDRESS
PROCEDURE   cva         (ADDRESS a);

cva converts to ADDRESS.

The LONG INTEGER and LONG BITS forms return the ADDRESS represented by l or b. This is a machine-dependent conversion; the same INTEGER or LONG BITS value may not correspond to a valid ADDRESS on every machine.

The CHARADR form converts the CHARADR to an ADDRESS; both the original CHARADR and the resulting ADDRESS refer to the same memory location, so that cvc(cva(c)) = c is TRUE for any CHARADR c. The bit pattern of the resulting ADDRESS is not necessarily the same as that of c, since the formats of CHARADRs and ADDRESSes may differ. If c is NULLCHARADR, cva returns NULLADDRESS.

The POINTER form returns the ADDRESS of the object referenced by p. If p is NULLPOINTER, the result is NULLADDRESS. The object referenced by p is subject to garbage collection; its address may change after the call to cva.

Example 32–80. Use of cva
ADDRESS a;
POINTER p;

a := displace(cva(p),size(integerCode))

Example 32–80 assigns to a the ADDRESS that is displaced by the number of storage units in an INTEGER from the ADDRESS of the object referenced by p.

The ADDRESS form of cva returns its argument.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 32.80