Mail Archives: djgpp/2002/12/12/20:00:19
From: | "Edd Dawson" <hotcakes AT planetquake DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | simple inequality evaluation fails?!?!
|
Lines: | 38
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2600.0000
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000
|
Message-ID: | <c5aK9.1738$2E.528@news-binary.blueyonder.co.uk>
|
Date: | Fri, 13 Dec 2002 00:49:57 -0000
|
NNTP-Posting-Host: | 80.192.26.95
|
X-Complaints-To: | abuse AT blueyonder DOT co DOT uk
|
X-Trace: | news-binary.blueyonder.co.uk 1039740360 80.192.26.95 (Fri, 13 Dec 2002 00:46:00 GMT)
|
NNTP-Posting-Date: | Fri, 13 Dec 2002 00:46:00 GMT
|
Organization: | blueyonder (post doesn't reflect views of blueyonder)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi,
I came across an unexpected result when executing a program I'm writing.
After tracking it down in the source, I wrote a few lines of test code and
found that a simple evaluation of an inequality was failing.
Here is the small chunk of test code from the program I am writing:
//test code starts here
printf("\nRPP = %d\n", raysperpixel);
if(raysperpixel < 1)
printf("%d is less than 1\n", raysperpixel);
else
printf("%d is greater than or equal to 1\n", raysperpixel);
//test code ends here
raysperpixel is an int (i.e its defined properly).
Here is the corresponding output:
RPP = -35
-35 is greater than or equal to 1
This makes about as much sense as the program's output! Can anyone help me
out? I'm pretty sure it's a bug, but I wanted to check here before making a
bug report.
I'd be happy to submit the source of my program if anyone wants to help me
further! = )
If it matters at all, the value of 'raysperpixel' was obtained from a string
using the strtol function from the standard library i.e I used the line:
raysperpixel = (int)strtol(keyvalues[8], NULL, 10);
Any help with this would be great, even if it's only to confirm that it's a
bug!
Edd
- Raw text -