Hello,
I faced one issue while working on a C code with Microsoft Visual Studio-2005 compiler.
I tried to declare a big buffer statically as :
int gbl_data[4096*4096*256];
EDIT: This declaration was a global variable in a header file.
It was giving an compilation error saying – “cannot allocate an array of constant size 0”.
Means somehow the size of 4096X4096X256 was getting too large than the MAX_INT_LIMIT size (2^31) and may be wrapping around and become –ve or so. But then it should have given error as “negative subscript”.
I tried casting the constants as 4096UL x 4096UL x 256UL , still same compilation error.
What is the cause of this error?
Is it because the physical memory size falling short to allocate this large size buffer or what?
What is the fix for it?
Thanks you.
-GM.