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...

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.

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.

commented: Nice - Salem +3

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

@ 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 ???

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.

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. ;)

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

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.

@ 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.

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 we can 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. ;)

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 :-|)

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.

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.

'nuff said.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.