delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/06/12:20:02

From: "Damian Yerrick" <die DOT spammers AT pineight DOT 8m DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how to use atof(); prototyping
Date: Mon, 6 Sep 1999 00:37:46 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 28
Message-ID: <7qvk26$bqr$1@solomon.cs.rose-hulman.edu>
References: <7qr9uh$3fk$1 AT thetenth DOT astat DOT de> <7qufgt$3hm$1 AT thetenth DOT astat DOT de>
NNTP-Posting-Host: yerricde.laptop.rose-hulman.edu
X-Trace: solomon.cs.rose-hulman.edu 936596358 12123 137.112.205.146 (6 Sep 1999 05:39:18 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 6 Sep 1999 05:39:18 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Berti Drost <Berti DOT drost AT gmx DOT net> had some problems with
atof() in the C library. (atof() converts a string to a double.)
Someone named Steven fixed the problem. Berti wrote:

> Ah...I've found the error...still strange: If I add
> #include <stdlib.h>
> it works correctly, if I don't, it can be compiled, but atof returns
strange
> numbers; I wonder why...
> (Thanx, Steven)

That's because atof() is prototyped in stdlib.h; a prototype tells
the C/C++ compiler how to convert parameters and return values
for a function. Turn on your compiler warnings with the -Wall option
in GCC to warn about missing prototypes in the future.

However, M$ Visual C-- insists on an explicit cast in every single
case; otherwise, it spams the compiler error output with dumb
warnings, something like "Warning: integer widths don't match;
converting." That's what makes me want to use RSXNTDJ.
Download it at the Zip Picker (http://www.delorie.com/djgpp);
then http://surf.to/rsxntdj to set it up

Damian Yerrick
http://come.to/yerrick


- Raw text -


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