From owner-freebsd-current Sat Mar 30 17:30:44 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id RAA29287 for current-outgoing; Sat, 30 Mar 1996 17:30:44 -0800 (PST) Received: from ibp.ibp.fr (ibp.ibp.fr [132.227.60.30]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id RAA29277 for ; Sat, 30 Mar 1996 17:30:40 -0800 (PST) Received: from blaise.ibp.fr (blaise.ibp.fr [132.227.60.1]) by ibp.ibp.fr (8.6.12/jtpda-5.0) with ESMTP id DAA10099 for ; Sun, 31 Mar 1996 03:30:38 +0200 Received: from (uucp@localhost) by blaise.ibp.fr (8.6.12/jtpda-5.0) with UUCP id DAA18241 for current@freebsd.org; Sun, 31 Mar 1996 03:30:47 +0200 Received: (uucp@localhost) by fasterix.frmug.fr.net (8.6.11/fasterix-941011) with UUCP id SAA29938 for current@freebsd.org; Sat, 30 Mar 1996 18:30:45 +0100 Received: (from regnauld@localhost) by tetard.frmug.fr.net (8.7.5/8.7.3/tetard-uucp-2.7) id PAA13952 for current@freebsd.org; Sat, 30 Mar 1996 15:36:27 +0100 (MET) From: Philippe Regnauld Message-Id: <199603301436.PAA13952@tetard.frmug.fr.net> Subject: Weird atof() behavior To: current@freebsd.org (current) Date: Sat, 30 Mar 1996 15:36:26 +0100 (MET) X-rene: Tu dois pas les avoir perdues, normalement. X-wing-fighter: et puis X-men, X-open, X-ta-mere... X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, 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 , gcc does NOT issue any sort of warning for atof(). Example: #include main() { foo* char="3.1415926"; float bar=atof(foo); printf("%f\n",bar); } Here's the output: -7.000000 This is obviously a GCC related problem (I've got the same results with current), as testing with 2.5.8 showed no problems. It seems that the value from is cast to a double, then cast to an int. The warning does show up with -Wall: atof.c:5: warning: implicit declaration of function `atof' -- Phil -- - [ regnauld@tetard.frmug.fr.net / +48.8N+2.3E / +33 1 4507 9391 / Sol 3 ] - - [ regnauld@freenix.fr / FreeBSD 2.x / ] - "Le schtroumpf est à l'homme ce que le bleu est au billard" - F.Berjon