delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/13/03:16:37

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: atof(...) Problem
Date: Wed, 12 May 1999 16:59:51 -0400
Organization: BrunNet
Lines: 28
Message-ID: <3739EBC7.A76D72C9@unb.ca>
References: <3735C5E2 DOT AB4BEBE2 AT t-online DOT de> <37374CB3 DOT FB83B34C AT unb DOT ca> <3737E645 DOT F50FC13E AT t-online DOT de>
NNTP-Posting-Host: ftnts2c44.brunnet.net
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (Win95; U)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jan wrote:

> Endlisnis wrote:
> > ... maybe you didn't include stdlib.h or something (even then it
> > shouldn't get 1, it got some huge number for me).
>
> Thanks, <stdlib.h> was the problem, but I thought that "rhide" make things
> like this automatically, since I put the option "Use standard libraries" on.

    That does not mean that it will include 'standard' h files for you, it just
means that it will link the standard libraries with your code.  That means that
all of the functions from libc will be available, but they still have to be
properly prototyped.  The problem is if a function is not prototyped, the return
value defaults to an 'int' which is interpreted much differently than a float.
So when atof returned the proper 'float' value, it was read out of memory (or
the register) as an integer bit pattern which gives irradic results (the results
are actually quite predictable, but not very useful or straightforward to
determine)

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT HotMail DOT com
          ICQ: 32959047




- Raw text -


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