From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) Subject: Re: function-->macro bugs. Date: 21 Nov 1992 12:36:16 GMT
jy10033@ehsn11.cen.uiuc.edu (Joshua M Yelon) writes:
>I'm not disagreeing with Lars, in fact I'm quite certain he's right,
>but I'm curious: how _do_ you replace a library routine?
You change the library source code. Only standard way to go. In ANSI
C, programs mustn't go around changing standard library routines. The
reason for this is that the rest of the library might depend on
certain weird behaviour of the routine under some circumstances, which
the replacement doesn't have. For instance, the library might have a
hidden flag, __make_malloc_free_instead__, which the real malloc
checks.
>Is THIS correct?
>
>#undef malloc
>void *malloc(n)
>int n;
>{
No. If only because malloc's argument is of type size_t.
>Or is there simply no way to do it?
Nope.