Compiler | Max Array Size Allowed by Compiler |
---|---|
Turbo C++ 3.0 | 64KB |
Java Compiler | 231-1 elements |
C#(and other.Net Compilers) | 264-1 elements |
Visual c++ | ~2GB |
Note that all these are static array declarations. Java restricts the maximum subscript value to the upperlimit of the primitive datatype int and C# to the upperlimit of the primitive ulong. VC & TC compilers restrict the array size not by a maximum subscript value, but by a maximum size reached by the structure. Although the VC++ compiler allows for the compilation of a structure as big as 2GB, during runtime a block of code can contain only 1MB worth of variable declarations(I'm not sure about this). Also notice that I've said approx. 2GB; while the other compilers allow the sizes mentioned to the dot, VC does not achieve the 2GB limit exactly.
There are those things that nag you for no particular reason. You can either ignore em or go ahead and open pandoras box. But be ready for the difficult questions that follow. I have quite a few of em. why those limits? And whats with VC arrays? without using dynamic allocation, can you really use the 2GB of allocation allowed by the compiler? Educate me! i feel like an ignoramus.
updated text in bold. my face is red.
pp: not really sure about all other .Net compilers; only the ones coming with VS.
urped by gumz @ 3:04 PM