home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.os.linux
- Subject: Re: function-->macro bugs.
- Message-ID: <1992Nov21.123616.10447@klaava.Helsinki.FI>
- Date: 21 Nov 92 12:36:16 GMT
- References: <By0ows.95I@news.cso.uiuc.edu> <1992Nov21.000241.9744@klaava.Helsinki.FI> <By1p2E.5L9@news.cso.uiuc.edu>
- Organization: University of Helsinki
- Lines: 28
-
- 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.
-
- --
- Lars.Wirzenius@helsinki.fi (finger wirzeniu@klaava.helsinki.fi)
- MS-DOS, you can't live with it, you can live without it.
-