🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6250

Re: Naming

#6250
From: Martin Weitzel
Date: Wed, 28 Feb 1990 12:16
26 lines
1492 bytes
In article <MCDANIEL.90Feb27103334@amara.amara.uucp> 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 <your own malloc>

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
Technical Details
Message-ID: <678@mwtech.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!unido!mikros!mwtech!martin
References: <MCDANIEL.90Feb20172440@orenda.amara.uucp> <1990Feb23.184656.3110@siia.mv.com> <16021@haddock.ima.isc.com> <MCDANIEL.90Feb27103

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <MCDANIEL.90Feb20172440@orenda.amara.uucp> <1990Feb23.184656.3110@siia.mv.com> <16021@haddock.ima.isc.com> <MCDANIEL.90Feb27103
Reply-To: martin@mwtech.UUCP (Martin Weitzel)
Organization: MIKROS Systemware, Darmstadt/W-Germany
Lines: 26