<stuff snipped>
>
>One more suggestion: naked pointers are evil. Naked pointers in an STL 
>container are doubly evil. Wrap that pointer in a boost::shared_ptr. Memory 
>is automatically delete-d as the list goes out of scope.

IMHO wasting cycles mainating reference counts when I know the lifetime of an
item and who is responsible for calling free or delete (depending on which was
used in the frist instance) is even worse than using bare pointers. I would
apply the same statement to C++ automagically copying things for me without a
good reason to do so.

In my experience if you do not know who has a reference to an object and what
the scope of those references are the code is almost certaintly wrong anyway.
Heavy STL users might not be so lucky but that may be just my prejudice. I
often want a variantion on a structure on an unusual operation to be
particularly fast so end up deciding STL is unsuitable and doing it manually
instead. I think this results in faster and cleaner code in most cases.

Of coure my view might be due to PRG propaganda and PRG are not OO fans. PRG,
aka the Oxford computer science department, are keen on formal methods and
introduced various formal methods, including CSP.

Yes, I know there is a certain amount of flame bait here. I will evn add to it
by saying that the UML descirption is dangeruous ambiguous and the use of UML
can only obfusciate any problem. Objects sending messages to each other are
very nasty to analyse and UML just about makes it impossiblke by being vague on
some critical points. Be warned that I have some reasons for the UML
deflamation :-)

-- 
Duncan (-:
"software industry, the: unique industry where selling substandard goods is
legal and you can charge extra for fixing the problems."


Reply via email to