I was checking how big of an array can I create on a X64 application, my understanding was that I can create arrays bigger than 2^31 on X64 process but I'm getting a compilation error on VS2010 compiler, below code
const size_t ARRSIZE = size_t(1)<<32;
int main()
{
char *cp = new char[ARRSIZE];
return 0;
}
gives compiler error "error C2148: total size of array must not exceed 0x7fffffff bytes" on VS2010 on target x64 platform, I can create upto (size_t(1)<<32 - 1);
I have Linker->Advanced->Target Machine is Machinex64. Also Linker->System->Enable Large Addresses as Yes ( Not sure if this really matters ). Does the paging file\Physical Ram present in the pc matter here? (I'm sure that it is a 64-bit app because if I remove that line and just have char* cp; it is 8-byte.) Am I missing some settings?