_self
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Keyword: _self
Syntax: _self
Summary: A base expression that names itself as a base.
See also: _based, _segment, _segname
The _self keyword can be used to cast to a segment value, as in
the example below:
typedef struct tree TREE;
struct tree
{
int name;
TREE _based( (_segment)_self )*left;
TREE _based( (_segment)_self )*right;
};
void main()
{
TREE _based( _segname( "MYSEGMENT" ) )t1;
}
Any based declarations that are based on _self must apply to
pointers only. Ordinary data objects cannot be self-based.
The example above declares a structure called tree and then
declares t1 to be such a structure. The pointers within the
structure are self-based, meaning that they will point within the
segment in which the tree structure is located.
-♦-