Help with function

Will Crowder will at charyb.COM
Sat Jan 13 05:59:31 AEST 1990


In article <2385 at ektools.UUCP> randolph at ektools.UUCP (Gary L. Randolph) writes:
>In article <3198 at cbnewsj.ATT.COM> veenu at 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



More information about the Comp.lang.c mailing list