C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Pointers Based on a Fixed Segment
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
     Pointers based on a fixed segment are restricted to accessing one
     segment of memory. By making assignments to the based pointer, you
     change only the offset portion of the address.
 
     Pointers Based on a Named Segment
 
     Form of <base>:
 
          __segname(<string literal>)
 
     The <string literal> can be the name of one of four predefined
     segments ("_CODE", "_CONST", "_DATA" or "_STACK"), or it can be
     the name of a new segment you define. A based pointer declared
     this way can address locations only in the specified segment.
 
     For example:
          // pointer into current code segment
          char __based(__segname("_CODE")) *bp;
 
     Pointers Based on the Segment of a Variable
 
     Form of <base>:
 
          (__segment)&<var>
 
     A based pointer declared this way uses the segment of the address
     of <var> as its base. It can address locations only in the same
     segment as <var>.
 
     For example:
 
          int i;
          // pointer using i's segment as its base
          char __based((__segment)&i) *bp;
                                    -♦-