◄Up► ◄Contents► ◄Index► ◄Back► ─────C/C++ Language───────────────────────────────────────────────────────── Data declared with __based is allocated in the segment specified. Data Stored in a Named Segment Form of <base>: __segname(<string literal>) The <string literal> can be the name of a predefined segment ("_CODE", "_CONST", or "_DATA", but not "_STACK"), or it can be the name of a new segment you define. For example: // string stored in current code segment char __based(__segname("_CODE")) cs[] = "code-based string"; External Data Based on a Segment Variable Form of <base>: <segvar> Data declared this way resides in a location determined at run time. You can relocate a segment in memory, set <segvar> to the new location of that segment, and access a variable stored in that segment without using pointers. Because no space is reserved for the variable at compile time, the variable must be declared as extern. For example: __segment seg1; extern char __based(seg1) c; Data Based on the Address of Another Variable Form of <base>: &<var> The <var> specified must be based on a named segment. This declaration places both variables in the same segment. For example: // int stored in segment MYSEGMENT int __based(__segname("MYSEGMENT")) myvar1; int __based( (__segment)&myvar1 ) myvar2; -♦-