Path: utzoo!attcan!uunet!charyb!will From: will@charyb.COM (Will Crowder) Newsgroups: comp.lang.c Subject: Re: Help with function Keywords: abs(), strtod(), don't work Message-ID: <346@charyb.COM> Date: 12 Jan 90 18:59:31 GMT References: <3198@cbnewsj.ATT.COM> <2385@ektools.UUCP> Reply-To: will@charyb.UUCP (Will Crowder) Followup-To: comp.lang.c Distribution: na Organization: KFW Corporation, Newbury Park, CA Lines: 36 Summary: In article <2385@ektools.UUCP> randolph@ektools.UUCP (Gary L. Randolph) writes: >In article <3198@cbnewsj.ATT.COM> veenu@cbnewsj.ATT.COM (veenu.r.rashid) writes: >> >> [description of strtod() problem I'm sure everyone's seen by now] > >Well, I can't duplicate the problem. I am using cfront 2.0 on a Sun and >all seems to work fine but I did have to make the following changes to >the code: > > I used fabs() rather than abs() > I called strtod as follows: > > temp = strtod(argv[1], NULL) /*ANSI definition*/ your >results was impossible. If that's all you are missing, I would be >dissappointed that the compiler didn't generate an error. >This is the sort of thing that would cause the described flakey >behavior. >Gary The compiler (a non-ANSI *NIX compiler) has no business generating an error since it knows nothing of the strtod() function. An ANSI compiler would generate an error in the presence of a conflicting prototype, but it's all-important to remember that non-ANSI compilers don't have the slightest idea what you're doing, so you'd better have some idea yourself. Will P.S. (Of course, lint would have trapped this error, but the compiler wouldn't have.) f o d d e r