Message-Id: <1.5.4b13.32.19960330161309.00674a48@oak-web.washington-ch.oh.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sat, 30 Mar 1996 11:13:09 -0500 To: "Michael A. Phelps" From: Daniel Pierce Subject: RE: lint for gjgpp? Cc: djgpp AT delorie DOT com At 05:28 PM 3/29/96 -0500, you wrote: >Just a guess, but perhaps if you made either a global or static char * to contain the "" message, it would work better. Otherwise, if it is to return "", I don't think you are returning a pointer to a valid memory address once the function exists. What happens if you try something like this in your function: > static char not_found_message[] = ""; > ... > else > return (not_found_message); > >gcc is much less forgiving about accessing unallocated (or not currently allocated) memory than is TC, so my hunch is that this is the reason why you are just experiencing this problem with DJGPP. > ---Michael Phelps, MD It returns the ok each time. The database is defined and loaded from an ascii text file and at program end written out to a different file name. Here's what it does: Database: 1 = "Mess1", 2 = "Mess2", 3 = "Mess3", 4 = "Mess4", etc. The prog calls say 1, 2, 3, 4, 2, 3, 4, etc. and returns "Mess1", "Mess1", "Mess1", "Mess1", "Mess2", "Mess2", "Mess2", etc. It randomly picks how long it's run of the same return lasts, then starts another run using the last new index. Very confusing. Each index call is checked, printf'ed to the screen, program paused, then return'ed, printf'ed, paused again. And what is sent in the return does not match up with what is received. The database is < 64K and is global. I could do it as a large switch but then the database can't be changed or added to. Prior version of the prog used a switch and that worked fine. I discovered the unallocation problems gcc has a few weeks ago and double checked all global variables to ensure nothing was left hanging empty. I checked out the source code for lint (linux) and can see why it hasn't been ported.