Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.std.c Subject: Re: Naming Message-ID: <678@mwtech.UUCP> Date: 28 Feb 90 12:16:36 GMT References: <1990Feb23.184656.3110@siia.mv.com> <16021@haddock.ima.isc.com> mcdaniel@amara.uucp (Tim McDaniel) writes: >drd@siia.mv.com (David Dick) writes: > [The names in the standard library are also reserved] > Remember that you can no longer "roll your own" version of any > of these routines. > >Are standard library names utterly and completely reserved, or can I >fake it with #define, as in > #define malloc(bytes) my_malloc(bytes, __FILE__, __LINE__) To be save, you should write a line #undef malloc before your redefinition (because every library-function might be defined as well as macro, if you include the appropiate standard header - stdlib.h in this case). To be save *and* portable you might even have to write: #ifdef malloc #undef malloc #endif #define The latter is *not* required in ANSI-C, because #undefs are legal if the given name is not defined as macro. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83