Compler Fun!

Jul 29, 2014 at 8:14pm
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 Jul 29, 2014 at 8:45pm
Jul 29, 2014 at 8:17pm
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.
Jul 29, 2014 at 8:35pm
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 Jul 29, 2014 at 8:37pm
Jul 29, 2014 at 8:38pm
@ 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 Jul 29, 2014 at 8:43pm
Jul 29, 2014 at 8:42pm
Here is how i know!
int pie[2147483647];


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


Jul 29, 2014 at 8:46pm
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 Jul 29, 2014 at 8:47pm
Jul 29, 2014 at 8:49pm
@ TheGentlmen: that's still not enough memory.
Jul 29, 2014 at 8:51pm
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 Jul 29, 2014 at 8:51pm
Jul 29, 2014 at 9:01pm
closed account (z1CpDjzh)
@AbstractionAnon I did not say 2000 i said 0xffffffff
Jul 29, 2014 at 9:06pm
TheGentlmen wrote:
@AbstractionAnon I did not say 2000 i said 0xffffffff

You said 2000, and then you edited your first post.
Jul 30, 2014 at 3:06am
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.