CompuServe Messages

MyArray[ long ]

    17-Jul-93 18:43:47
Sb: MyArray[ long ]
Fm: John Jeppson 76174,2007
To: ALL
In C and/or C++ is there any limitation on the index of an array? Can the index be larger than an "int"? Can it, for example, be a long on systems where a long is larger than an int? This would mean, of course, that the compiler would have to code for 32-bit offset addressing. I know that with MPW C an int and a long are each 4 bytes, and experiment shows that large arrays do work properly when compiled with MPW. How about in Think C where an int is 2 bytes. Can you still make and index into arrays such as char* largeArray = new char[ 0x12345 ]; assuming, of course, the array will fit in memory. How about Think C++ (which I have finally ordered since MPW appears to be doomed).