Paulo de Oliveira Eneas <[EMAIL PROTECTED]> wrote:
>
> I working in a project that uses a very big struct whose size is
> approx 4.0 MB. If I declare a struct variable within the main
> (actually, winmain) function I get a stack overflow and the
> programm crashes. If I declare  the structure variable in the
> global scope, everything goes OK.

The C90 language only guarantees that one object of 32767 bytes can
be allocated. Of course, this is impractical for real applications,
but the same standard does allow dynamic allocation to potentially
exceed that, in a testable way.

You can pass any size_t value to malloc and it will either allocate
the block, or it will return a null pointer.

But I think we're focusing too much on your choice of solution. It
would be better if you explained the real problem, and why you need
4MB structs in the first place.

--
Peter





To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=298184.5639630.6699735.3001176/D=groups/S=:HM/A=2434971/rand=810998037


Yahoo! Groups Links

Reply via email to