From owner-freebsd-current Fri May 24 12:17:56 2002 Delivered-To: freebsd-current@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id CC24B37B421; Fri, 24 May 2002 12:13:37 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id 994A7AE1D1; Fri, 24 May 2002 12:13:37 -0700 (PDT) Date: Fri, 24 May 2002 12:13:37 -0700 From: Alfred Perlstein To: Chris Hedley Cc: Mike Barcroft , freebsd-current@freebsd.org Subject: Re: strtod & sscanf on -CURRENT? Message-ID: <20020524191337.GK54960@elvis.mu.org> References: <20020524131550.C26122@espresso.q9media.com> <20020524184214.M3863-100000@teabag.cbhnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020524184214.M3863-100000@teabag.cbhnet> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Chris Hedley [020524 10:53] wrote: > On Fri, 24 May 2002, Mike Barcroft wrote: > > Would it be possible for you to reproduce the source to a small > > program that demonstrates the problem? > > Okay, here's a cheap'n'nasty program to demonstrate the problem; the > revised problem seems to be that strtod() is okay with integers but if a > period is present in the value passed to it, it returns the count of the > digits after the period, rather oddly: You forgot to include stdlib.h. Please compile things with -Wall before reporting "weirdness" on the lists. ~ % gcc -Wall t.c t.c:4: warning: return type defaults to `int' t.c: In function `main': t.c:10: warning: implicit declaration of function `tolower' t.c:10: warning: implicit declaration of function `exit' t.c:11: warning: implicit declaration of function `strchr' t.c:11: warning: suggest parentheses around assignment used as truth value t.c:13: warning: implicit declaration of function `strtod' That's from the code you posted, scary what can happen and how much of waste of your and our time this was. :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message