Futurebasic/Language/Reference/offsetof
OFFSETOF
[edit | edit source]Function
[edit | edit source](+) Appearance (+) Standard (+) Console
Syntax
[edit | edit source]byteOffset = OFFSETOF(fieldName IN {recordType|trueRecVar}) byteOffset = OFFSETOF(const [IN pseudoRecVar])
Description
[edit | edit source]Use this function to find where a particular field begins within a record. OFFSETOF returns the field's offset as a number of bytes past the beginning of the record. In the first syntax, recordType is the name of a "true record" type as defined in a BEGIN RECORD statement; trueRecVar is a variable declared as a "true record" type; fieldName is the name of a field within that "true record" type. In the second syntax, const is a symbolic integer constant, without its leading underscore character. Typically, this will be a constant which was defined within a DIM RECORD...DIM END RECORD block. pseudoRecVar.recLen is a "pseudo-record" variable declared as DIM psuedoRecVar.recLen. When you use the second syntax, OFFSETOF just returns the value of const. Because a symbolic constant always has a global scope, the IN pseudoRecVar clause is not required. The value passed as fieldName is seen by the compiler as a constant. You do not use type designator suffixes like $,&,#, etc.
See Also
[edit | edit source]SIZEOF; TYPEOF; BEGIN RECORD; DIM RECORD; Appendix C: Data Types and Data Representation