Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to make a C++ array which have size bigger than 32767

Reply
Thread Tools

How to make a C++ array which have size bigger than 32767

 
 
Andi Tse
Guest
Posts: n/a
 
      09-23-2004
I found it is not work when I access myarray[32768]. Thx.
 
Reply With Quote
 
 
 
 
Thomas Matthews
Guest
Posts: n/a
 
      09-23-2004
Andi Tse wrote:
> I found it is not work when I access myarray[32768]. Thx.

Show your code.

What is the array type?

There is a big difference in size of an array between
an array of char and an array of float or a large class.

Have you tried allocating using operator new?

Have you checked your compiler documents to see if there
is a limit to the quantity of elements in an array?

Have you checked your compiler documentation to see if
there is a size restriction for an array declared as
auto?


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

 
Reply With Quote
 
 
 
 
William Payne
Guest
Posts: n/a
 
      09-23-2004

"Andi Tse" wrote:
>I found it is not work when I access myarray[32768]. Thx.


Hi Andi, not a very informative post. Sounds to me like you're trying to
create a very large array on the stack, and that won't work because the
stack relatively very small.
Try dynamic allocation, i.e., using new. For example:
char* foo = new char[some_big_integer_constant];
Don't forget to deallocate with a corresponding call to delete [].
Or you could use one of the many containers provided by the STL.

/ WP


 
Reply With Quote
 
PKH
Guest
Posts: n/a
 
      09-23-2004

"Andi Tse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
>I found it is not work when I access myarray[32768]. Thx.


Maybe you are using 16 bits int's to access it ? If you switch to unsigned
int's you can access up to 65535, or switch to 32-bits unsigned integers
(dword) where the limit is 2^32 - 1 which is > 4.2 billion.
Just guessing .

PKH




 
Reply With Quote
 
Vaclav Haisman
Guest
Posts: n/a
 
      09-24-2004
....or maybe you are using Borland C++ 3.1? If so you should really switch to
something better.

VH

"Andi Tse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
>I found it is not work when I access myarray[32768]. Thx.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Serialization file getting bigger and bigger on the same object yancheng.cheok@gmail.com Java 2 04-10-2007 09:26 AM
Need Help: IP pckts w/IP length field value that is bigger than the real frame size algoral_2000 Cisco 0 03-31-2005 11:28 PM
I have created a website "lookup" i dont think its gonna get bigger and fancyer than it already is but have a look Rahmi Acar C++ 0 04-20-2004 10:18 PM
App getting bigger and bigger Yannick Turgeon Perl Misc 1 10-14-2003 04:47 AM



Advertisments