Re: cleanup of cbrt() handling

Lists: pgsql-patches
From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: cleanup of cbrt() handling
Date: 2003-05-25 05:30:37
Message-ID: 200305250530.h4P5Ubp07906@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

This patch cleans up our static cbrt() implementation in float.c.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.2 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cleanup of cbrt() handling
Date: 2003-05-25 06:05:17
Message-ID: 3818.1053842717@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> This patch cleans up our static cbrt() implementation in float.c.

Looks like an improvement to me.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cleanup of cbrt() handling
Date: 2003-05-25 14:06:11
Message-ID: 200305251406.h4PE6Be13500@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > This patch cleans up our static cbrt() implementation in float.c.
>
> Looks like an improvement to me.

Yep, however, now that I look at the original code, and code that
shipped in 7.3:

#ifndef HAVE_CBRT
#define cbrt my_cbrt
static double cbrt(double x);

#else
#if !defined(nextstep)
extern double cbrt(double x);
#endif
#endif /* HAVE_CBRT */

There is no my_cbrt() function, meaning anyone who didn't have cbrt
couldn't have even compiled 7.3, so I think we should just remove cbrt,
or mark it as UNUSED.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cleanup of cbrt() handling
Date: 2003-05-25 14:57:11
Message-ID: 5575.1053874631@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> #ifndef HAVE_CBRT
> #define cbrt my_cbrt
> static double cbrt(double x);

> #else
> #if !defined(nextstep)
> extern double cbrt(double x);
> #endif
> #endif /* HAVE_CBRT */

> There is no my_cbrt() function, meaning anyone who didn't have cbrt
> couldn't have even compiled 7.3, so I think we should just remove
> cbrt,

No, you're misreading the point of the code. The #define changes the
spelling of the static declaration. The idea evidently is to make sure
that there is no conflict of the static function against a library
cbrt(), on the off chance that configure missed finding it somehow.
This might be overly tricky --- certainly we do not take comparable
precautions for other library-substitute functions. I wouldn't object
to removing the "#define cbrt my_cbrt". But you have *no* proof that
removing the whole thing won't break some supported platform.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cleanup of cbrt() handling
Date: 2003-05-26 00:45:26
Message-ID: 200305260045.h4Q0jQr17776@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > #ifndef HAVE_CBRT
> > #define cbrt my_cbrt
> > static double cbrt(double x);
>
> > #else
> > #if !defined(nextstep)
> > extern double cbrt(double x);
> > #endif
> > #endif /* HAVE_CBRT */
>
> > There is no my_cbrt() function, meaning anyone who didn't have cbrt
> > couldn't have even compiled 7.3, so I think we should just remove
> > cbrt,
>
> No, you're misreading the point of the code. The #define changes the
> spelling of the static declaration. The idea evidently is to make sure
> that there is no conflict of the static function against a library
> cbrt(), on the off chance that configure missed finding it somehow.
> This might be overly tricky --- certainly we do not take comparable
> precautions for other library-substitute functions. I wouldn't object
> to removing the "#define cbrt my_cbrt". But you have *no* proof that
> removing the whole thing won't break some supported platform.

Oh, I see, it makes all cbrt cases by my_cbrt, including the function
calls _and_ function definition. I already removed my_cbrt, so let's
see how it works in 7.4.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073