Click here to Skip to main content
15,503,808 members

Comments by Emilio Garavaglia (Top 200 by date)

Emilio Garavaglia 16-Aug-13 4:04am View    
Reason for my vote of 3 \n It's all a matter of taste. Good justifications for yours, but anyone else may have good ones for his own.
Emilio Garavaglia 16-Mar-13 17:14pm View    
gee, at least post a link: this is a website, after all!
Emilio Garavaglia 14-Feb-13 5:52am View    
This is a non-sense: if you are restricted to only C++ you can use std::string being std::string part of the C++ spec, otherwinse you are not using C++ (in proper sense).

Unless the real problem is the use of dynamic memory, but in that case the way you prototyped wont help, since
- you still need it and ...
- you will be in trouble managing it:

In general, returning a char* is not a good C++ practice, sine it is not clear who got the memory it points to and who will be in charge to release it. Your functions -as they are now- are potential sources of memory leaks.

Much better can be writing yourself a class that wraps that pointer and keep managing the memory itself.

But OOPS... that will be nothing more than another std::string or CString or whatever.
So what's the clue, here?
Emilio Garavaglia 6-Feb-13 11:01am View    
Good in OOP school sense, "Type case defeats the purpose of OOP, abuses it" can become harmful if abused conversely: there is a risk to place in the base class all the potential methods of all it's potential derived. This is called a "god-object". The "good thing" stays somewhere in the middle. But no "school" models it.
Emilio Garavaglia 5-Feb-13 7:24am View    
I've no doubt it works, but that's not C++, since it refers to functions belonging to the C standard library and not to the C++ one. It works because of backward compatibility, but if everything "works with both C and C++" there is no clue to have C++ at all.