PRB: Arrays Larger Than 64k Not Allowed with /qc Option

ID Number: Q74834

6.00 6.00a 6.00ax 7.00 | 6.00 6.00a

MS-DOS | OS/2

Summary:

SYMPTOMS

When using the Microsoft C Compiler versions 6.0, 6.0a, or 6.0ax, the

following error message may be generated:

error C2125: 'arrary' : allocation exceeds 64K

With C/C++ version 7.0 the following error may be generated:

error C2176: static huge data not supported by 'identifier'

CAUSE

When using the quick compile option (/qc) with Microsoft C version

6.0, 6.0a, or 6.0ax, statically defined arrays must not be larger

than 64K bytes. Unlike compiling without the /qc option (full

compile), the quick compiler cannot generate code for arrays larger

than 64K bytes even if huge model is selected.

In C/C++ version 7.0, the cause is that the array is not declared

huge, but /AH was specified.

RESOLUTION

Specifying huge model (/AH) will not change the behavior of the quick

compiler. You must remove /qc from your compile line.

More Information:

In the sample code below, the case where the array is actually

declared with the huge keyword (that is, char huge array[100000]), the

quick compiler does generate the following additional error:

error C2176: static huge data not supported by /qc

Future plans call for this error to also be generated with the quick

compiler when the array is not declared as huge but the /AH option is

specified on the command line.

Sample Code

-----------

/* Compile options needed: /AH /qc

*/

char array[100000];