Please enable JavaScript to view this site.

ESL Documentation

Special Built-in Function

Return the size of a structure in bytes.

size of STRUCT_TYPE

STRUCT_TYPE

The name of a previously defined structure type.

Description

This function returns an integer that is the size in bytes of a structure type.

This function is most useful for external APIs that accept the address of a structure variable (obtained in ESL via the handle of built-in function), and the size of that structure as arguments.

Use the size of function to automatically calculate the size of a structure type wherever such APIs are used. This is safer than manual calculations, and eliminates the possibility that the actual structure size gets out of synch with the values used to represent that size.

The value of this function is determined at compile-time.

Example

 

structure Point is # structure type called "point"

 integer X using integer size 2

 integer Y using integer size 2

end structure

 

structure Point Center # structure variable of type Point integer PointSize # integer variable to hold size

 

response to start

 copy (size of Point) to PointSize

 call GetPoint (Center, PointSize)