Saturday, 15 May 2010

c++ - Does C have a 64k limit on declared variable size? -



c++ - Does C have a 64k limit on declared variable size? -

first allow me explain circuit designer, not software engineer, maybe question falls "well duhhh" category.

i have problems when declare variable array requires more 64k of memory. e.g.

char myvar[100000];

the compiler doesn't give error messages or warnings, code has obvious memory problems. i.e. weird execution can't tracked in debugger.

i knew there memory limitations 20 years ago, thought windows solved problems.

i realize solution utilize new operator, puzzled can't find documentation on this.

does c have 64k limit on declared variable size? utilize c++ builder xe3.

the look std::numeric_limits<size_t>::max() absolute upper limit, on modern machines, size_t 64 bits, in 32 bit world, 32 bits. compiler or runtime may impose additional limits; under windows, example, stack size extremely limited, may runtime errors if allocate much on stack. , i've managed "out of memory" compiler (g++) tables bit. (that machine generated code, , tables had initializers, compiler had save them.)

still, not expect 100000 cause problems on modern machine, on stack. i'd surprised if problem. there still memory restrictions, measured in megabytes.

c++ c++builder

No comments:

Post a Comment