Re: Code guidelines, state of C++ compilers used, and general C++ comments


Subject: Re: Code guidelines, state of C++ compilers used, and general C++ comments
From: Mike Nordell (tamlin@algonet.se)
Date: Tue May 09 2000 - 02:14:04 CDT


Leonard Rosenthol wrote:
>At 8:04 PM -0500 5/8/00, Justin Bradford wrote:
>>
>>The DELETEP/FREEP macros also set the variable to NULL.
>>I believe the current implementation is something like:
>>#define DELETEP(s) do { if (s) delete(s); (s) = NULL; } while (0)
>
>Shouldn't be we using good C++ coding techniques and using
>"inlines" instead of #defines??

I definitely agree with you. However, as we currently can't use template
functions for this kind of stuff, macros are the only way to go. If/when
this is loosened, the DELETEP macro would probably be replaced by
template<class T> void DELETEP(T*& p) { delete p; p = 0; }

Another issue is the usage of of e.g. "#define FOO 3" where "const int
FOO = 3;" would be more appropriate.

/Mike - please only post follow-ups to the list



This archive was generated by hypermail 2b25 : Tue May 09 2000 - 01:14:27 CDT