Message-Id: <199912170730.JAA26530@www.Foo.COM> From: "S. M. Halloran" Organization: User RFC 822- and 1123-compliant To: "Alex" Date: Fri, 17 Dec 1999 09:38:00 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Memory problem, (I think) CC: djgpp AT delorie DOT com In-reply-to: <83ci0u$84lc$1@newssvr03-int.news.prodigy.com> X-mailer: Pegasus Mail for Win32 (v3.12b) Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 16 Dec 99, Alex was found to have commented thusly: > Ok here's my problem. This works: > int main() > { > char thing[10000][400] > } It doesn't compile without the semicolon after the local variable definition. It compiles after enter it however. :) It didn't run for me either. My test returned '1' and indicated a stack fault. I didn't symify the stack trace, but I could guess that it didn't even get out of startup code (i.e., was not able even to call main()). > But this doesn't: > #include > int main() > { > char thing[10000][400] > getch(); > } After adding the missing semicolon to the variable definition, I get a different problem this time. Returns '255' and the fault is SIGSEGV (that's what you're seeing, right?). I agree this is a problem. > Can anyone tell me why??? This problem is really getting to me, any help > will be a godsend!!! You probably like to code on UNIX workstations or machines with no imaginable resource limitations, don't you? Anyway, these DOS/Windows/PC compilers need hints that you like to rely on huge stacks rather than taking what you need from the heap. This newsgroup has a FAQ, and I believe you can find your answer in the number 15.9 of that document. After you go over the details, then a quick read of the rest of the FAQ might help you to recall other subjects commonly touched upon. Btw, I added a "return (0);" statement to main so I could see that main() returning normally (otherwise it returns anything in the test), or if you use getch() whatever it returns ('27' if you hit ESC key). I then cut out the 'unsigned _stklen = 1048576;' definition in the FAQ, inserted '* 8' (multipy by 8) between the constant and semicolon, to account for your particular use of stack space, ran it, and it returned zero for me, without generating a fault or exception. Based on that, I'd say the code now does what I expect....whether that is the same as "the code works," well, on a Friday, I can never be that positive. :-) > Thanks in advance, > alexwaag AT prodigy DOT net Mitch Halloran Research (Bio)chemist Duzen Laboratories Group Ankara TURKEY