Problem with declare Array ! Please help me ! thanks very much!

Login to reply to this topic.
Mon, 2006-03-20 10:52
Joined: 2005-06-21
Forum posts: 107
Hi all!
I want to declare array with 800000 elements . this my code:

TInt32 Data[sizeof(TInt32)];

But have error.Please help me ! Thanks very much

--------------------- doctinh113114------------

Mon, 2006-03-20 11:14
Joined: 2004-12-03
Forum posts: 276
Re: Problem with declare Array ! Please help me ! thanks very mu
Quote
TInt32 Data[sizeof(TInt32)]

First of all you cannot use Non-Constant value for defining an array.... Secondly this will allocate array of size 4 (sizeof(TInt32)) if such declarations were allowed in Symbian.

Quote
I want to declare array with 800000 elements

Also if you want to declare so big array I will suggest don't declare them on stack... use heap..... e.g. HBufC...
your default stack is around 8k.....

Today is a gift by GOD, that's why it is called the present.

Mon, 2006-03-20 12:05
Joined: 2005-11-20
Forum posts: 1246
Re: Problem with declare Array ! Please help me ! thanks very mu
Furthermore, it may well be that your program does not need 800'000 elements all the time, but only in very rare extreme situations. If this is indeed the case, it would be much better to work with an array that grows as needed, like CArrayFixFlat that Symbian offers.

René Brunner

  • Login to reply to this topic.