Am Freitag, 3. November 2006 12:21 schrieb Gerard Krol: > Dennis Schridde wrote: > > Am Donnerstag, 2. November 2006 22:27 schrieb Troman: > >>> ----- Original Message ----- > >>> From: "Dennis Schridde" <[EMAIL PROTECTED]> > >>> To: "Development list" <email@example.com> > >>> Sent: Wednesday, November 01, 2006 11:50 PM > >>> Subject: Re: [Warzone-dev] More patches for warnings > >>> > >>> Am Mittwoch, 1. November 2006 23:03 schrieb Gerard Krol: > >>>> Hi, > >>>> > >>>> This evenings work ;) > >>>> > >>>> new.patch contains the addition of two macro's, and the use of them to > >>>> replace MALLOC > >>> > >>> MALLOC itself is a macro around some custom wrapper around malloc... > >>> So perhaps we should also check if we (additionally to using this NEW > >>> wrapper) > >>> could drop that MALLOC malloc wrapper... > >>> (I don't really know what exact functionality MALLOC and FREE provide, > >>> besides > >>> that FREE checks for NULL pointers, what is useless as free() is > >>> defined by the C std to do nothing in that case.) > >>> > >>> --Dennis > >>> > >>> PS: Idea seems good, didn't look at the patch. > >> > >> It is a cleaner approach, but for me it is more intuitively to use > >> MALLOC since already the name implies that malloc functionality will be > >> used at some point. And these 2 new macros will not replace all > >> occurances of MALLOC, so we are just introducing more macros for the > >> same functionality. > >> > >> But anyway, I will be an impartial executor of a collective opinion. To > >> make it painless for everyone if no objections will be raised until > >> tomorrow evening I will just go on and apply the patch. > > > > Well, then make it MALLOC instead. NEW is also more C++ style... > > I'd be ok with it, but it doesn't bring much real benefit, though you > > could even don't use NEW. Also most ppl would probably not use NEW anyway > > as they are used to MALLOC/malloc and that's what's used in most of the > > code. You are right YaWM (Yet another Wrapper Macro) is probably not > > needed and would clutter the code even more. > > I have a lot more experience using the C++ new than the C malloc, as you > guessed, so the new seems more natural to me. > And how about calling it "MALLOC_NEW"? That's ugly, if that NEW thingy is added I'd do it as NEW and don't mix it up with MALLOC and whatnot... On one hand NEW is smaller, less to type and easier to read. On the other hand it is another wrapper. Actually I thought it would replace the MALLOC...
Additionally MALLOC has this NULL checks which don't do nothing, so we could also skip them. Or create some debug output if someone wants to free a NULL pointer, as Per suggested? The latter sounds sensible in debug mode. In ndebug I'd just remove it (if it is present there, too). And actually I'd really love to get rid of this MALLOC thingy if possible and sensible. I guess that it doesn't bring much benefit on modern machines and was mostly needed for PSX or similar. If we need to optimize the mallocing with a memory pool or similar one day, we can add it back then. --Dennis
Description: PGP signature
_______________________________________________ Warzone-dev mailing list Warzonefirstname.lastname@example.org https://mail.gna.org/listinfo/warzone-dev