![]() |
How to make a C++ array which have size bigger than 32767
I found it is not work when I access myarray[32768]. Thx.
|
Re: How to make a C++ array which have size bigger than 32767
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 |
Re: How to make a C++ array which have size bigger than 32767
"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 |
Re: How to make a C++ array which have size bigger than 32767
"Andi Tse" <tomoya_mikami@hotmail.com> wrote in message news:bf11713f.0409230543.3b94cd49@posting.google.c 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 |
Re: How to make a C++ array which have size bigger than 32767
....or maybe you are using Borland C++ 3.1? If so you should really switch to
something better. VH "Andi Tse" <tomoya_mikami@hotmail.com> wrote in message news:bf11713f.0409230543.3b94cd49@posting.google.c om... >I found it is not work when I access myarray[32768]. Thx. |
| All times are GMT. The time now is 08:29 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.