tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strtod not in namespace.h?



On 11/10/24 1:00 AM, Valery Ushakov wrote:
I noticed that strtod(3) is not in libc's namespace.h though it's
sibling strtof(3) is (along with others).  Is this an oversight?

I tried to link inferno-os statically (to check that I get the -l
order right for the X11 libs) and got:

ld: /usr/lib/../lib/sparc/libc.a(strtod.o): in function `_strtold':
strtod.c:(.text+0x19c0): multiple definition of `strtod'; /home/uwe/work/inferno/inferno/NetBSD/sparc/lib/libmath.a(dtoa.o):/home/uwe/work/inferno/inferno/libmath/dtoa.c:676: first defined here

inferno has its own version of dtoa.c that defines its own strtod.

Our libc defines both strtod(3) and strtod_l(3) in the same file and
vfscanf.c pulls in strtod.c for _strtold_l, and since strtod is not
namespaced, it conflicts with the inferno's version.

Shouln't we add

   #define strtod _strtod

to namespace.h?

Normally you are not supposed to replace standard functions. We make an exception for hysterical reasons for the malloc family, but that's about it. Especially since strtod is part of the C standard itself.

Joerg


Home | Main Index | Thread Index | Old Index