|
From: Per W. <pw...@ia...> - 2007-11-04 23:08:19
|
Replace "statically" with auto, for arrays declared on the stack. Global arrays are not stored on the stack, and may be as large as the processor can supply memory. /pwm On Sun, 4 Nov 2007, Jonathan Winterflood wrote: > Hi, > > Statically allocated arrays (as in type var[SIZE];) are allocated on the > stack, so the limit would be the stack size. However, allocating more than a > rather limited number (say 10,20) is generally a bad idea, since you don't > know how big the stack is, etc. > > For larger arrays, it's a better idea to dynamically allocate (malloc/calloc > in C) > type *var = calloc(sizeof(type),SIZE); //add checks > You should then be limited by the memory available. > After that, you probably can't allocate more than 2^32-1 > bytes, which is the max value of an INT32, supposing you're on a 32-bit system. > That > said, it's unlikely you'll be able to allocate that much anyways: that's 4Gb.... > > HTH, > Jonathan > > On 11/4/07, Amar Alabiari <a_j...@ho...> wrote: > > > > Hi, > > > > Is there any size limit on the array or the matrix that can be used in C > > or C++? Or does it depend on the compiler rather than the language? > > > > Thanks for answering. > > > > Alberto. > > > > ------------------------------ > > Send a smile, make someone laugh, have some fun! Start now!<http://www.freemessengeremoticons.ca/?icid=EMENCA122> > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > -- > <Morpheus> linux, c'est une question de VI ou de MORE > |