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: Justin Bradford (justin@ukans.edu)
Date: Mon May 08 2000 - 20:04:21 CDT
- sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
- Next message: Martin Sevior: "Re: hj focus fix patch."
- Previous message: Pierre Abbat: "Re: Index and Contents for Help File"
- In reply to: Mike Nordell: "Code guidelines, state of C++ compilers used, and general C++ comments"
- Next in thread: Leonard Rosenthol: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Next in thread: sam th: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Reply: Justin Bradford: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Reply: Leonard Rosenthol: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Reply: Mike Nordell: "Re: Code guidelines, state of C++ compilers used, and general C++comments"
On Tue, 9 May 2000, Mike Nordell wrote:
> To use an intrusive double linked list template class could really be of
> benefit. An (incomplete) example of how such an interface could look like
> can be found with my patch of fp_Run.
I thought we had a policy against templates.
> I also note that the macro DELETEP is somewhat redundant in its
> implementation. It's always legal in C++ to delete a null pointer, e.g.
> delete (int*)0;
> The compiler does all the checking for you. To have this check once again
> in a macro only produces larger binaries, and adds nothing.
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)
NULLing the pointer is a good thing, as it makes debugging easier.
As for bloat, a decent compiler should make that macro only a few
operations longer than a plain delete(s); You can try changing the macro
recompiling and compare binary sizes. My guess is 1-2K difference (ie.
trivial).
Justin
- Next message: Martin Sevior: "Re: hj focus fix patch."
- Previous message: Pierre Abbat: "Re: Index and Contents for Help File"
- In reply to: Mike Nordell: "Code guidelines, state of C++ compilers used, and general C++ comments"
- Next in thread: Leonard Rosenthol: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Next in thread: sam th: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Reply: Justin Bradford: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Reply: Leonard Rosenthol: "Re: Code guidelines, state of C++ compilers used, and general C++ comments"
- Reply: Mike Nordell: "Re: Code guidelines, state of C++ compilers used, and general C++comments"
This archive was generated by hypermail 2b25
: Mon May 08 2000 - 20:04:28 CDT