size of array "" is too large

Nicholas Sherlock n.sherlock@gmail.com
Thu Jul 17 12:09:00 GMT 2008


Hariharan wrote:
> [...] in a 16-bit target (picochip), you cannot define,
>
> struct trial
> {
>   long a[10000];
> };
>
> In the case above, i get a
> "size of array ‘a’ is too large" error.
>
> The thing that took me by surprise was, if i split the structure to
>
> struct trial
> {
>   long a[5000];
>   long b[5000];
> };
>
> This works fine. 
If your "long" is 32-bit, then your first array covers more memory than 
the range of a signed 16-bit integer, whereas the second set of arrays 
doesn't hit this limitation. Perhaps the limitation is forced on GCC by 
the limitations of your target.

Cheers,
Nicholas Sherlock



More information about the Gcc mailing list