16.4 Using Huge Data

You can declare data as huge in C-language modules. CL will correctly perform the arithmetic required to increment the pointer across segment boundaries. You can pass a huge pointer to Windows library functions or to your own functions that expect a far pointer, but only if the function is not expected to internally increment the far pointer so that it points to an object that straddles a 64K boundary. For example, the following code is acceptable, because 16 is a factor of 64K (65,356):

char huge Record[10000][16];
int i;

TextOut(hDC, x, y, (LPSTR) Record[i], 16);

The following example violates this limitation, because the pointer passed to the TextOut function will eventually point to an object that straddles a 64K boundary:

char huge Record[10000][15];
int i;

    /* DON'T DO THIS. */

TextOut(hDC, x, y, (LPSTR) Record[i], 15);

Since 15 is not a factor of 64K, the pointer would be incremented across a segment boundary.