www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/09/14:07:16

Date: Tue, 9 Aug 1994 11:21:16 -0300
From: "Michael T. Smith" <aa529 AT cfn DOT cs DOT dal DOT ca>
Subject: Compiler's fault?
To: djgpp AT sun DOT soe DOT clarkson DOT edu

I finished an early beta version of a program that I am writing this 
morning, and after a little tweaking, it worked fine. There is a section 
of it that converts numbers between Hex/Dec/Oct/Bin, and that section was 
working fine, except that there would be an L after every number, i.e.:
43743 Dec = 			(converted numbers are made up)

BFFCL Hex
775455L Oct

The L's were probably a result of the fact that the numbers were long 
unsigned ints, and my conversion specifier in the printf was %XL, %oL, 
etc. I decided to take off the L's by changing the conversion specifier 
to %X, %o, etc. I recompiled the program after those changes, and the 
conversion part didn't work right, so I went back and put the L's back in 
the conversion specifier. After recompiling the program, it *seemed* to 
work right, at least the parts other than the conversion parts, but when 
I did a Decimal to All conversion, and entered 3653 to be converted, it 
might do something like this:
16542 Dec =

32542 Oct
BFAEC Hex
and every time the numbers would be the same, even if I entered a 
different number. In fact, the menu wouldn't work--every choice was 
suddenly mapped to "Convert from Decimal to All"! I don't think that this 
is my program's fault, but I will send the code fragments in question to 
anyone who asks for them, so that it can aid them in helping me. Any help 
would be appreciated. I am using DJGPP 1.11.maint2 with GCC 2.5.7.

****************************************************************
* Michael Smith       * Dartmouth, NS (Canada)                 *
* aa529 AT cfn DOT cs DOT dal DOT ca * Chebucto FreeNet (902)494-8006         *
****************************************************************
* Words of Wisdom:                                             *
* Beware of programmers carrying screwdrivers.                 *
* MACINTOSH: Machine Always Crashes If Not The OS Hangs        *
****************************************************************


- Raw text -


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