home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / linux / 17442 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  1.3 KB

  1. Path: sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!hydra!klaava!wirzeniu
  2. From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
  3. Newsgroups: comp.os.linux
  4. Subject: Re: function-->macro bugs.
  5. Message-ID: <1992Nov21.123616.10447@klaava.Helsinki.FI>
  6. Date: 21 Nov 92 12:36:16 GMT
  7. References: <By0ows.95I@news.cso.uiuc.edu> <1992Nov21.000241.9744@klaava.Helsinki.FI> <By1p2E.5L9@news.cso.uiuc.edu>
  8. Organization: University of Helsinki
  9. Lines: 28
  10.  
  11. jy10033@ehsn11.cen.uiuc.edu (Joshua M Yelon) writes:
  12. >I'm not disagreeing with Lars, in fact I'm quite certain he's right,
  13. >but I'm curious:  how _do_ you replace a library routine?
  14.  
  15. You change the library source code.  Only standard way to go.  In ANSI
  16. C, programs mustn't go around changing standard library routines.  The
  17. reason for this is that the rest of the library might depend on
  18. certain weird behaviour of the routine under some circumstances, which
  19. the replacement doesn't have.  For instance, the library might have a
  20. hidden flag, __make_malloc_free_instead__, which the real malloc
  21. checks.
  22.  
  23. >Is THIS correct?
  24. >
  25. >#undef malloc
  26. >void *malloc(n)
  27. >int n;
  28. >{
  29.  
  30. No.  If only because malloc's argument is of type size_t.
  31.  
  32. >Or is there simply no way to do it?
  33.  
  34. Nope.
  35.  
  36. --
  37. Lars.Wirzenius@helsinki.fi  (finger wirzeniu@klaava.helsinki.fi)
  38.    MS-DOS, you can't live with it, you can live without it.
  39.