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 - <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 each 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 each 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 adjusted
        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