Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!psuvax1!psuvm!cmh117 From: CMH117@psuvm.psu.edu (Charles Hannum) Newsgroups: comp.lang.c Subject: Re: FREE Message-ID: <90057.131754CMH117@psuvm.psu.edu> Date: 26 Feb 90 18:17:54 GMT References: <2714@stl.stc.co.uk> Organization: Penn State University Lines: 32 Why don't you try: #define NE_ARR_MALLOC(n) ((y *)calloc(n, sizeof(y))) #define NE_ARR_FREE(x) (free(x), x=NULL) In your original posting, you were trying to pass the length of x (which is the size of the pointer) to free(). This won't work. You should just pass x itself. Also, your use of a block structure in NE_ARR_FREE points out a disturbing problem in C. If I have something like: if (conda) definea(junk); else defineb(junk); Will work fine if definea() and defineb() are either functions or single-line #defines. But what about multiple-line #defined macros? In this case, you can work around it with the , operator, but in many cases you cannot. For compilers that support inline function calls (read: macros that look like functions) that would be the best solution. But with those that don't ... Virtually, - Charles Martin Hannum II "Klein bottle for sale ... inquire within." (That's Charles to you!) "To life immortal!" cmh117@psuvm.{bitnet,psu.edu} "No noozzzz izzz netzzzsnoozzzzz..." c9h@psuecl.{bitnet,psu.edu} "Mem'ry, all alone in the moonlight ..."