MAINSAIL Language Manual, Section 32.72

previous   next   top   contents   index   framed top   this page unframed


32.72. $createRecord

Figure 32–73. $createRecord
POINTER
PROCEDURE   $createRecord
                        (
POINTER p;
                         
OPTIONAL POINTER($areaarea);

p is a POINTER to a record, CLASS descriptor, or data section. If p is invalid, an error message is generated and NULLPOINTER returned. Otherwise, a dynamic record is allocated with the data fields described by the associated CLASS descriptor, and a POINTER to the record is returned. The record is allocated in area.

The behavior when p points to a data section will probably change in future versions of MAINSAIL; you should avoid passing data section POINTERs to $createRecord.

The principal use of $createRecord is to allocate a record of the same CLASS as another record of which the CLASS is not known at compiletime, as shown in Example 32–74.

Example 32–74. Use of $createRecord
POINTER p,q;
... 
p gets set to a record of an unknown CLASS ...
q := $createRecord(p); # Now q's CLASS is same as p's


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 32.72