Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Mar 1996 12:52:19 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.org, regnauld@tetard.frmug.fr.net
Subject:   Re: Weird atof() behavior
Message-ID:  <199603310252.MAA06978@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help

>	A  friend of mine  has had  some problems with  Rayshade running on
>	2.0.5 (GCC   2.6.3)   -- it appeared   that  atof()  systematically
>	returned bogus values in certain conditions: if you omit to specify
>	#include <stdlib.h>,  gcc  does NOT issue  any sort  of warning for
>	atof().  Example:

>	#include <stdio.h>

>	main()
>	{
>		foo* char="3.1415926";
>		float bar=atof(foo);
>		printf("%f\n",bar);
>	}
>...
>	The warning does show up with -Wall:
>	
>	atof.c:5: warning: implicit declaration of function `atof'

This looks like a warning to me.  The behaviour is undefined because
atof is implicitly declared as returning `int' but actually returns
`double'.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603310252.MAA06978>