N_TAGS and Object Class Definition Structures
Although an instance of an object class has an associated structure definition, it is not generally possible to inspect the tags defined by the class structure directly using N_TAGS. The exception to this rule is that inside an object method you can use N_TAGS to inspect the class structure of an object reference.
Find the number of tags in the system variable !P and print the result by entering:
Find the length of !P, in bytes:
Returns the number of structure tags and optionally returns the size, in bytes, of the structure.
The expression for which the number of structure tags is to be returned. Expressions that are not of structure type are considered to have no tags. N_TAGS does not search for tags recursively, so if Expression is a structure containing nested structures, only the number of tags in the outermost structure are counted.
Set this keyword to return the total length of all the data fields contained within the structure, in bytes. This differs from LENGTH in that it does not include any alignment padding required by the structure.
The length of the data for a given structure will be the same on any system, as long as the data does not contain strings.
If a data field contains a string, the DATA_LENGTH keyword returns the length of the string’s internal descriptor, rather than the length of the string data. (In IDL, strings are represented internally using a descriptor structure that contains information about the string, including its length and a pointer to the string data.) This means that on a given machine, the DATA_LENGTH keyword will report the same length value for all fields containing string data, regardless of the contents of the strings.
Note: The length of a string descriptor can vary between machines, and also between 32‑bit and 64‑bit versions of IDL. Length differences are caused by differences in structure alignment rules or the size of a machine pointer on the system, and are fundamental properties of the underlying system.
Note: The length of a structure is machine dependent. The length of a given structure will vary depending upon the host machine. IDL pads and aligns structures in a manner consistent with the host machine’s C compiler.
This page has no user notes yet. Be the first one!