Announcing C++ posting guidelines

R

red floyd

S

SG


"1. Is language X better than C++?"

Your answer implies that it's only a matter of taste. That's not the
whole truth. The programming language choice is also driven by the
application domain. Different languages have different strengths in
different domains.


"2. I have a problem with this template..."

You are implying that templates are only useful for "container of T"
things. That's not true. You even suggest that templates are a sign
of bad design. I'm sure not many would agree with you. In Java I
used runtime polymorphism because it was the only abstraction
mechanism to make code reusable. In C++ you can use both features.
If you don't need runtime polymorhism but still want to keep your code
reusable templates are a nice option. Templates and runtime
polymorphism can even be combined via "type erasure".


"5. Why function pointer in member function doesn't work?"

Your answer to that one advocates replacing function pointers by
classes with virtual functions because function pointers are
supposedly bad. It's actually not all that black and white. See
templates, functors, Boost.Function, ...


In C++ you have an abundance of design choices. The use of one
particular language feature is not necessarily a bad thing. It
depends on the context which makes it difficult to write general rules
about what feature to use and what not to use.


Cheers!
SG
 
M

Michael DOUBEZ

Juha Nieminen a écrit :
"Should I set the pointer NULL after delete?"
"No."

I find that answer a bit questionable. What do you think eg. auto_ptr
does with its pointer?

Your argument is not pertinent: auto_ptr<> doesn't set it to NULL after
deleting it. Neither in its destructor nor in release() or reset() -
although the parameter's default value is NULL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,440
Latest member
YoungBorel

Latest Threads

Top