Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_huge _huge -- non-standard type modifier</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _huge                   _huge -- Non-Standard Type Modifier

    A huge data item may be located anywhere in memory and is not assumed
    to reside in the current data segment.  A huge data item can exceed
    64K bytes in size.  Its address is 32 bits long.  Huge does not apply
    to functions, only data.

    Huge pointers are similar to far pointers, in that both are 32-bit
    pointers containing a 16-bit segment address and 16-bit offset.  Huge
    pointers, however, are normalized, which means that as much of its
    value as possible is stored in the segment address.  This means that
    the offset portion of a huge pointer cannot be larger than 15 (base
    10) because segments start every 16 bytes (base 10).

    As a result of the normalization of huge pointers, there is only one
    huge pointer for any specific memory address.  That's quite different
    than the situation with far pointers, in which many different
    segment:offset pairs can refer to the same address.  The following
    ramifications arise from the fact that there is only one huge pointer
    for a specific address:

        The == and != operators work correctly with huge pointers; they
        do not always work correctly with far pointers.

        The results of the <, <=, >, and >= operators work correctly with
        huge pointers.

        Most importantly, huge pointers do not "wrap-around."  Because of
        normalization, the segment portion of a huge pointer is
        incremented every time the offset "wraps" from 15 back to 0.
        Because the segment portion is constantly adjusted, you can use
        huge pointers to work with data structures greater than 64k in
        size.

      Notes:    The price of using huge pointers is the additional time
                involved in the overhead of normalization.  Huge pointer
                operations are noticeably slower than far or near pointer
                operations.

                Depending on the model specified at compile-time,
                sizeof(char _huge *) may or may not be the same as
                sizeof(char *).

                The _huge keyword is typically needed for very large
                arrays.

                Variables declared with class auto are always near, since
                they reside on the run-time stack. If you specify auto
                and _huge, _huge will be ignored. However, you may have a
                _huge pointer auto object.  Therefore, _huge is only useful
                with static or extern objects, or function return values.

   -------------------------------- Example ---------------------------------

           char _huge table[70000];
           char _huge *hpc;
           char _huge **hppc;
           char _huge * _huge *hphpc;
           long int _huge *check();

           i = sizeof(char _huge *);




See Also: _near _far auto static extern

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson