954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Max size of Array

Hello

I'm working on an application.
I need as big arrays as possible. At home I work with linux there I can declare array as big as this: char buffer[1000000]. No probleme.

In work I'm working with boreland C++ 4.5 (WinXp) and I can't declare biger size of array as buffer[20000].
It tels me << constant is long << and << array size too large;

It is possible to change this? or Is there some reason to not declare bigger Arrays like this?

Please help...

slacke
Junior Poster
106 posts since Jun 2006
Reputation Points: 14
Solved Threads: 7
 

Hello

I'm working on an application. I need as big arrays as possible. At home I work with linux there I can declare array as big as this: char buffer[1000000]. No probleme.

In work I'm working with boreland C++ 4.5 (WinXp) and I can't declare biger size of array as buffer[20000]. It tels me << constant is long << and << array size too large;

It is possible to change this? or Is there some reason to not declare bigger Arrays like this?

Please help...


I never worked with borland but probably U need to change the stack size in your compiler options. So go for help and find stack size. U can try also to declare the array as global becouse then its not using the stack.

andor
Posting Whiz in Training
276 posts since Jun 2005
Reputation Points: 251
Solved Threads: 29
 

Depends on which version of that compiler is used -- 16-bit MS-DOS or 32-bit MS-Windows? 16-bit can create arrays up to only 64,000 bytes (large memory model), or 16,000 long integers. There is no work-around other than to redesign your program or use a modern 32-bit compiler, which is one reason MS-DOS is dead and buried.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Borland 4.5 is a 16 bit compiler. Upgrade to Borland 5.5 for 32 bit.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

@ slake

Why stick to Borland ???
If you are thinking about compiler migration better go for the free Visual Studio 2005 free edition or for GCC mingw compiler which nowadays most of the people use.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 
Why stick to Borland ???


Why not? There's nothing wrong with the Borland compiler. It's when a bad compiler is in use you should change. But when you get right down to it, for the most part if it does the job, any compiler will do.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 
Why not? There's nothing wrong with the Borland compiler. It's when a bad compiler is in use you should change. But when you get right down to it, for the most part if it does the job, any compiler will do.

I didnt say anything is wrong with the compiler,my suggestions were purely based on personal choice, just wanted the OP to know the choices he has.

BTW since you seem to be a Borland proponent you might want to take a look here: http://www.willus.com/ccomp_benchmark.shtml?p6
http://www.willus.com/ccomp.shtml?p03


Nothing personal, just found these when i was once looking for good compilers. ;)

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

Cant imagine why you want to allocate all that space statically. Use another data structure which resides on the heap - a list perhaps.

peterbyrne
Newbie Poster
16 posts since Oct 2006
Reputation Points: 10
Solved Threads: 1
 

boaland 5.5 and earlier have the same problem as VC++ 6.0 -- they are too old and do not support current C++ standards very well. And that is a big problem for new people who are trying to learn modern c++ with an ancient compiler. There are a few legatimate reasons I can think of for using those old compilers (such as support of legacy programs) but most people should be using newer compilers. when you say "they work" do you mean they work with code written in 2006 or code written in the 1980s and 1990s (10 years is a lifetime in the software and compiler industries!) The last time c++ standards were upgraded was in 1999 which is well after those borland and microsoft vc++ 6.0 compilers were produced.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

@ slake

Why stick to Borland ??? If you are thinking about compiler migration better go for the free Visual Studio 2005 free edition or for GCC mingw compiler which nowadays most of the people use.


Why stick to Borland ??? Right on ~s.o.s~! Borland is a sinking ship!

The Visual Studio 2005 free edition is huge! Kind of takes over your computer. I would go for GCC which is part of the free Dev-C++ IDE.

Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
 
I need as big arrays as possible.


You never need arrays to be as big as possible 'cause there's always a way to work around painful memory drains. Since you use an old compiler, you should think like we did when we were using them. Basically, memory is like gold. It's super rare and super valuable, and you have to make the most of every little bit. If you have to take more than your fair share, don't let anyone see you do it. ;)

Nowadays we can waste memory all willy nilly because nobody scowls as us when we do and users aren't up in arms when our software grinds their system to a screeching halt. 'Course, just because wecan doesn't mean we should. Get a good feel of the limitations that programmers used to work with. It's good for you! :cheesy:

No, really. If you get used to writing conservative code then you'll be a better programmer from the experience. It takes more talent to break your dataset into bite size pieces, process each piece, and put it all back together efficiently than it does to gobble everything up into an array and listen to your users whine in the distance. ;)

Inanna
Junior Poster in Training
90 posts since Oct 2006
Reputation Points: 53
Solved Threads: 6
 

As I was reading some discusion forums they talked a lot about borland C++, I just want to see how it looks like.
I probably make a mistake when I belived the web-site from where I download it - it said: "download the leatest version..." my mistake.
I have also installed the Dev-C++ so I go on using that one.

And yes you probably have right with aray size. I was having that feeling when I lunched the thread
or Is there some reason to not declare bigger Arrays like this?
I did'nt read about more complicated data structs yet (mistake). ( I was eager to write some code :-|)

slacke
Junior Poster
106 posts since Jun 2006
Reputation Points: 14
Solved Threads: 7
 
boaland 5.5 and earlier have the same problem as VC++ 6.0 -- they are too old and do not support current C++ standards very well.


I guess I don't consider beig released in 2000 to be "too old" but I guess that's just me. Use what you like ad works for you.

'nuff said.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

VC++ 6.0 was released in 1998 and the current c++ standards was released in Oct 1998. Borland 5.5 compiler was released in 2000, which is not enough time to have included very much, if any, of the C++ standards.

And yes, 6 years is a long long time for compilers to be around.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
'nuff said.

I knew this discussion would turn out this way :mrgreen:

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You