Compler Fun!

closed account (z1CpDjzh)
So i am going to need a symbol table for my compiler but i have just discovered that an array is limited to about 0xffffffff elements and i am going to need more elements so what should i use?

EDIT: I ment and integer array
Last edited on
Where did you hear about that limitation? AFAIK, the size of an array is only limited by std::size_t and the amount of memory of the computer.

The former will very likely never get touched. The latter will still take very large arrays of fairly large objects to get even close to on a modern computer.
closed account (z1CpDjzh)
@ResidentBiscuit Whats the 'former' and the 'latter'?

Here is how i know!
int pie[2147483647];int pie[0xffffffff];
Both Give:
	2	IntelliSense: array is too large	c:\Users\****\Documents\Visual Studio 2012\Projects\Incom Machine\Incom Machine\Incom Machine.cpp	12	6	Incom Machine
Last edited on
@ ResidentBiscuit: I think he probably means a char array allocated on the stack.

TheGentlmen wrote:
and i am going to need more elements so what should i use?

http://www.cplusplus.com/doc/tutorial/dynamic/

Edit:

int pie[2147483647];

Wow. If a single int is 4 bytes wide, then that array uses:

2,147,483,647 * 4 bytes
= 8,589,934,588 bytes
~
do you have 8 gigabytes of memory?
Last edited on
Here is how i know!
int pie[2147483647];


How does that prove "an array is limited to about 2000 elements" ?


closed account (z1CpDjzh)
@Catfish Yes i do... My laptop has 8 GB DDR3 Memory. 5.7 of them is not being used.
Last edited on
@ TheGentlmen: that's still not enough memory.
closed account (z1CpDjzh)
@Catfish You asked if i had 8 GB and i do.... I just need to close a couple dozen programs or so (:
Last edited on
closed account (z1CpDjzh)
@AbstractionAnon I did not say 2000 i said 0xffffffff
TheGentlmen wrote:
@AbstractionAnon I did not say 2000 i said 0xffffffff

You said 2000, and then you edited your first post.
Just because you have 8GB of memory doesn't mean that the operating system is going to give you 8GB of memory. On my system, the most it'll give me is 1GB (though I only have 2GB of RAM). In any case, one of the 'couple dozen programs' that you need to close will include the operating system - if you have exactly 8GB of memory, and you need exactly 8GB of memory, that leaves 8GB - 8GB = 0B of memory for everything else, i.e., nothing.
Topic archived. No new replies allowed.