Futurebasic/Language/Reference/offsetof

From Wikibooks, open books for an open world
< Futurebasic | Language | Reference
Jump to: navigation, search

Contents

[edit] OFFSETOF

[edit] Function

(+) Appearance (+) Standard (+) Console

[edit] Syntax

byteOffset = OFFSETOF(fieldName IN {recordType|trueRecVar})
byteOffset = OFFSETOF(const [IN pseudoRecVar]) 

[edit] Description

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.

[edit] See Also

SIZEOF; TYPEOF; BEGIN RECORD; DIM RECORD; Appendix C: Data Types and Data Representation

Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox
Sister projects
Print/export