Article View: vmsnet.internals
Article #386(None)
From: REGI's
Date: Thu, 15 Oct 1992 14:32
Date: Thu, 15 Oct 1992 14:32
80 lines
3347 bytes
3347 bytes
>X-Envelope-to: macro32@WKUVX1.bitnet
>X-VMS-To: IN::"macro32@WKUVX1.BITNET"
1
14-OCT-1992 00:51:51.01
1 00:00:00.00
15-OCT-1992 00:51:51.01
@UKCC.uky.edu:MacroMan@WKUVX1.BITNET
gutier@SEVAXU.CICA.ES
Received: from UKCC.uky.edu by ESEVVX.CICA.ES ; 11-OCT-1992 00:51:48.32
Received: from ukcc.uky.edu by UKCC.uky.edu (IBM VM SMTP V2R2)
with BSMTP id 9449; Sat, 10 Oct 92 19:50:42 EDT
Received: from WKUVX1.BITNET by ukcc.uky.edu (Mailer R2.08) with BSMTP id 2626;
Sat, 10 Oct 92 19:50:40 EDT
Errors-To: MacroMan@WKUVX1.BITNET
X-ListName: "VMS Internals, MACRO, and BLISS Discussions"
<MACRO32@WKUVX1.BITNET>
Received: from UGA.CC.UGA.EDU (MAILER) by WKUVX1 (MX V3.1C) with BSMTP; Sat, 10
Oct 1992 18:10:58 CDT
Received: from UGA by UGA.CC.UGA.EDU (Mailer R2.08 PTF008) with BSMTP id 0872;
Sat, 10 Oct 92 12:23:08 EDT
Received: from inet-gw-2.pa.dec.com by uga.cc.uga.edu (IBM VM SMTP V2R2) with
TCP; Sat, 10 Oct 92 12:23:07 EDT
Received: by inet-gw-2.pa.dec.com; id AA08167; Sat, 10 Oct 92 09:24:02 -0700
Received: by vbormc.vbo.dec.com; id AA20403; Sat, 10 Oct 92 17:19:11 +0100
Message-ID: <9210101619.AA20403@vbormc.vbo.dec.com>
Received: from taveng.enet; by vbormc.enet; Sat, 10 Oct 92 17:19:17 MET
Date: Sat, 10 Oct 92 17:19:17 MET
X-MX-Warning: Warning -- Invalid "From" header.
From: Yaacov Fenster @ISO 882-3153 10-Oct-1992 1823
<fenster@taveng.enet.dec.com>
Reply-To: MACRO32@WKUVX1.BITNET
To: macro32@WKUVX1.BITNET
CC: fenster@taveng.enet.dec.com
Apparently-To: macro32@wkuvx1.bitnet
Subject: RE: malloc() as a user defined function
> From: VBORMC::"MACRO32@WKUVX1.BITNET" "MAIL-11 Daemon" 9-OCT-1992 21:28:56.38
> To: MACRO32@WKUVX1.BITNET
> CC:
> Subj: malloc() as a user defined function
>
>
> Hi netters:
>
> In programming on dynamic memory allocation, I prefer doing check on
> every malloc(). I.e.:
>
> if ((p=(SOME_TYPE *)malloc(sizeof(SOME_TYPE))) == NULL) {
> printf("Malloc error.\n");
> exit(0);
> }
>
> It turned out it's a pain to type in the above four lines if I have
> lots of malloc() invocations in the program, also, the program looks
> ugly. So I tried to use a function called my_malloc():
>
> SOME_TYPE *my_malloc()
> {
> SOME_TYPE *p;
>
> if ((p=(SOME_TYPE *)malloc(sizeof(SOME_TYPE))) == NULL) {
> printf("Malloc error.\n");
> exit(0);
> }
> return(p);
> }
>
Try my_malloc() returning type of "void *", this will convert into any "type *"
type.
Yaacov
-------------------------------------------------
Yaacov Fenster +(972)-3-9307239
y.fenster@ieee.org
fenster@taveng.enet.dec.com DTN 882-3153
All the opinions voiced are mine alone and do not reflect anyone else's
opinion. (Including Dec).
Technical Details
Message-ID:
<01GPZDUYXRZ40001ZZ@esevvx.cica.es>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32 From: REGI's <NUNEZ@esevvx.cica.es> Newsgroups: vmsnet.internals Subject: (None) Message-ID: <01GPZDUYXRZ40001ZZ@esevvx.cica.es> Date: Thu, 15 Oct 1992 15:32:00 UTC+0100 Organization: Macro32<==>Vmsnet.Internals Gateway X-Gateway-Source-Info: Mailing List Lines: 80