delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/28/12:01:45

Newsgroups: comp.os.msdos.djgpp
From: cigna AT helios DOT phy DOT OhioU DOT Edu (Dave Cigna)
Subject: Re: DJGPP vs Borland C++
Message-ID: <E4q03L.FoE@boss.cs.ohiou.edu>
Sender: news AT boss DOT cs DOT ohiou DOT edu (News Admin)
Organization: Ohio University Physics and Astronomy
References: <5c1qik$9sh AT lion DOT cs DOT latrobe DOT edu DOT au> <32ECF799 DOT 74EF AT olis DOT net DOT au> <5ci12n$fbd AT star DOT cs DOT vu DOT nl> <32EDA0EE DOT 676F AT olis DOT net DOT au>
Date: Tue, 28 Jan 1997 13:28:33 GMT
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Linley Henzell  <zel AT olis DOT net DOT au> wrote:
>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
[snip]
>> : 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.

This is a typical symptom of NULL and uninitialized pointers. Real mode 
DOS programs (as compiled by Borland) don't care where your pointers are 
pointing when you try to use them, but in protected mode you'll generate 
a segmentation violation (SIGSEGV) if you try to access memory that you
don't own. This includes memory address 0, commonly called 'NULL' or 'NIL'.

>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? 

Hmm... atoi() takes a pointer. I'll bet a box of 360k diskettes that
the pointer is either NULL or points to memory that you never allocated.

 -- Dave Cigna

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019