From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,470194d770d13319 X-Google-Attributes: gid1014db,public X-Google-Thread: f8f3e,470194d770d13319 X-Google-Attributes: gidf8f3e,public X-Google-Thread: 1164f8,470194d770d13319 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-10-14 07:33:29 PST Xref: gmd.de comp.lang.c:32404 comp.sys.dec:10889 comp.sys.next.bugs:901 Path: gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!swrinde!news.dell.com!natinst.com!cs.utexas.edu!uunet!psinntp!bhnrc!doherty From: doherty@bhnrc.usda.gov (Bob Doherty) Newsgroups: comp.lang.c,comp.sys.dec,comp.sys.next.bugs Subject: Re: clib atof() question Message-ID: <1993Oct14.090651.80@bhnrc.usda.gov> Date: 14 Oct 93 09:06:51 EDT References: <1993Oct14.043648.1611@sfu.ca> Organization: Beltsville Human Nutrition Research Center -- USDA In article <1993Oct14.043648.1611@sfu.ca>, bill@sfu.ca (Bill Baines) writes: [snip, snip] > -------------------- > #include > int main() > { > double f1; > char *s1 = "1234.567"; > > f1 = atof(s1); > printf("%s, %f\n",s1, f1); > } > -------------------- [snip, snip] > So, Sun and SGI seem to work while Next and VMS don't. Have I left something > out here? Compiler switches? > The problem is that the atof prototype is specified by the ANSI standard to be in stdlib.h, not math.h. Even though VAX/VMS C is not an ANSI C compiler, the atof prototype is in stdlib.h. The same situation obtains for Next, apparently. It appears as if SunOS and IRIX get it wrong. With the change in the included file to stdlib.h, under VAX/VMS C and gcc under VMS, the above program produces the same output as SunOS and IRIX. -- ********************************************************************* * Bob Doherty * Beltsville Human Nutrition Research Center * * B161 R216A * EMAIL: doherty@bhnrc.usda.gov * * BARC-East * doherty@Eisner.DECUS.Org * * Beltsville, MD 20705 * bob.doherty@his.com * * (301)-504-8147 * * *********************************************************************