From: Linley Henzell Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP vs Borland C++ Date: Mon, 27 Jan 1997 22:47:10 -0800 Organization: Microtronics Information Systems Lines: 47 Message-ID: <32EDA0EE.676F@olis.net.au> References: <5c1qik$9sh AT lion DOT cs DOT latrobe DOT edu DOT au> <32E98087 DOT 6A50 AT cs DOT com> <32ECF799 DOT 74EF AT olis DOT net DOT au> <5ci12n$fbd AT star DOT cs DOT vu DOT nl> Reply-To: zel AT olis DOT net DOT au NNTP-Posting-Host: ppp07.olis.net.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Ruiter de M wrote: > > Linley Henzell (zel AT olis DOT net DOT au) wrote: > : Well, I'm having some problems with a C program written with Borland C++ > : 3.1 which refuses to work with DJGPP v2. It compiles fine, but every > : time I run it, it aborts with a SIGSEGV GPF. I have no idea why this > : happens, because it seems to choose a completely arbitrary point at > : which to abort (I checked with Symify), and my program contains nothing > : which I can imagine being objectionable (like pointers or dynamic memory > : allocation). > : Meanwhile, a little test program works okay with DJGPP. > : > : Borland's compiler has no problems whatsoever with it, and I've rarely > : had any problems with BC++. If anybody knows about something which > : Borland C++ 3.1 copes with, but which DJGPP just doesn't like, I would > : really appreciate them letting me know so that I can remove it from my > : program! Any assistance in this problem would be greatly appreciated. > > Assure you compile with -Wall (and -W) and you have the newest DJGPP- > version 2.01. Several bugs have been fixed since the first v2. > I personally have experienced problems like these, also with gcc on UNIX. > Somewhere I did 'var = 0;' and the program crashed... But it was because > of an error I made and I didn't notice the warnings about it. > > Maybe you could post some code? I bet someone will be able to help you. > > I am sure every compiler has its bugs, but I have found gcc and DJGPP to be > very stable. > -- I eventually found the problem by hacking chunks of code from my source until it worked. Because the program crashed at apparently innocuous places, the printf debugging method (which I usually use) wasn't much help, but I finally managed to isolate my problem to a call to atoi. For some reason, djgpp just doesn't seem to like my programs calling this function. And I am using v2; is this one of its documented bugs? Sometimes, although only sometimes, symify showed the GPF to have ocurred at a call to strtol, which I never use. Because this sounded a bit like atoi (it means "string to long" or something like that), I removed the atoi and it worked almost fine. I still have to cope with a few minor irritations, like the immense volume of warnings which djgpp generates (even without -Wall), and the doubling of my .exe file from ~150K to over 300K, but I can cope with that. Thanks for the help, Linley Henzell