home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!uunet.ca!ohrd!nkripoto
- From: nkripoto@rd.hydro.on.ca (Nick Kripotos (T))
- Subject: Is this a Bug in Borland C++ 2.0
- Message-ID: <1992Dec22.200126.24911@rd.hydro.on.ca>
- Organization: Ontario Hydro - Research Division
- Date: Tue, 22 Dec 92 20:01:26 GMT
- Lines: 50
-
- Hello there everyone. I have a small problem which is more of a nuisance
- and would like to fix it.
-
- I have a piece of code which compiles and links no problem. However sometimes
- when I try to run the executable the computer will crash or I get a message
- like the following:
-
- Abnormal program termination
- Floating point error: Domain
-
- Sometimes all I do is add a simple printf statement and the program crashes
- when I try to execute it. This usually happens after a few normal compilations
- and then a crash will occur
-
- I think it must be the way I'm allocating memory but I can't tell.
-
- Here is a chuck of my code:
-
- #define MAX_READ_BYTES 65532
- #define unsigned int SIGPT
-
- ulong MaxBufPts;
- SIGPT *DBuffer;
-
- etc.
-
- if ((MaxBufPts=farcoreleft()/sizeof(SIGPT)))>MAX_READ_BYTES/sizeof(SIGPT))
- {
- MaxBufPts=MAX_READ_BYTES/sizeof(SIGPT);
- }
- if ((DBuffer=(SIGPT *)farmalloc(MaxBufPts*sizeof(SIGPT)))==NULL)
- {
- printf("Not enough memory");
- }
-
- etc.
-
- farfree(DBuffer);
-
- end
-
- At first I didn't have the farfree(DBuffer) line but then I added it and
- I still get the occasional crash.
-
- If anyone has any ideas or suggestions please post or e-mail me at
-
- kripotos@ice5.kcps.rd.hydro.on.ca
-
- Thanks
- Nick
-