Mail Archives: djgpp/1999/10/24/09:31:26
On Fri, 22 Oct 1999, George Ryot wrote:
> The DJGPP startup code calls the globbing function which in turn calls
> qsort which has been redefined to do something bad.
That's correct; the startup code sorts the globbed wildcards, if any,
into alphabetical order.
> Whether this is a program or compiler bug hinges on whether or not it
> is legal to have user defined functions which overide those in libc.
>
> I am fairly sure that it is, and so this is indeed a DJGPP bug.
The ANSI C Standard permits to supply your own versions of library
functions, but only if the substitute has the same interface and
functionality as the original.
In particular, the Standard says that any standard C function (`qsort'
is one of them) has an ``external linkage'', and that any declaration
you write for such a function must agree in type and meaning with the
definition provided by the compiler (in this case, the
compiler-provided definition is in the header stdlib.h).
Your example violates this requirement by providing an incompatible
definition of `qsort'.
- Raw text -