This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: another baby step - namespace adjustments
DJ Delorie <dj@redhat.com> writes:
>> libiberty:
>> * approx-sqrt.c: New file.
>> * Makefile.in (CFILES): Add approx-sqrt.c.
>> (REQUIRED_OFILES): Add approx-sqrt.o.
>> * functions.texi: Regenerate.
>> include:
>> * libiberty.h: Prototype approx_sqrt.
>
> This doesn't make sense. There's already a standard sqrt() function.
> If that's not portable enough,
It's not that it's not portable enough, it's that jumping through the
necessary hoops to link cc1 against libm.so when and only when this is
required is too much trouble.
> adding sqrt() to libiberty is the right solution. I don't think it
> makes sense to add a non-standard replacement to libiberty when
> there's already a standard one to mimic.
It is inappropriate to call this routine sqrt() unless it meets the
accuracy requirements of the C standard, which requires considerable
additional complexity. That is why it has a nonstandard name.
zw