Re: qsort vs MSVC build - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: qsort vs MSVC build
Date
Msg-id 20061019180114.GA13348@svana.org
Whole thread Raw
In response to Re: qsort vs MSVC build  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Oct 19, 2006 at 01:56:24PM -0400, Tom Lane wrote:
> Is it worth renaming our qsort to pg_qsort to avoid this?  (I'd be
> inclined to do that via a macro "#define qsort pg_qsort", not by running
> around and changing all the code.)

Redefining a function that is defined in POSIX and present on most
systems seems like a bad idea. Not in the least because ELF linking
rules mean that if any library (say libssl) in the backend calls qsort,
they'll get the postgresql one, rather than the C library like they
expect. That seems fragile to me.

The #define would be fine, as long as you make sure it's called after
the system headers, otherwise the problem isn't fixed.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: qsort vs MSVC build
Next
From: Neil Conway
Date:
Subject: Re: CVS repository rsync