... and that appendix then torn out by the bookseller.
Printable View
... and that appendix then torn out by the bookseller.
What about CString of MFC.
Dont it will cause a performance bottleneck. You may like just because it has pretty of member to solve variety of string problems.
MFC drawback is documented but std::string may not be (I didnt try to see that).
I think you(all) should test the performance with copying, comparing, concatenating and so on on about 1000 strings within a loop!!!
Rather than make vague claims and tell everyone else to do some research, do you have some hard results you would like to share with us?Quote:
I think you(all) should test the performance with copying, comparing, concatenating and so on on about 1000 strings within a loop!!!
Some hard conclusions you've reached that aren't generally obvious like less instructions usually equals higher performance?
And those findings are of course offset with an analysis of the long-term costs of using code of greater complexity in the name of saving a few CPU cycles?
Or is it dependent on situation to situation? And if that's the case, then why not go with the tools that are easier to code initially so you can spend more time worrying about keeping to the implementation design and less time worrying about deleting[] all those bloody new char[]? Or buffer overruns? Or not allocating enough memory? Or leaking memory? Etc, etc, etc.
Regards,
Bassman
I think we should find the mix between good code maintenance (less errors and wasting debugging hours) and acceptable speed.
I would try MFCs CString, but ... this means VC will link all the bloated MFC code into my program?
This is done with
#include <stdafx.h>
im right?
Get the program to work first, then find where there are probable slow spots by properly profiling the code.Quote:
Originally posted by indiocolifa
I think we should find the mix between good code maintenance (less errors and wasting debugging hours) and acceptable speed.
I still hold that trying to do what std::string does using <string.h> functions is a waste of time, especially when you discover you've spent all the time coding something that has very minimal speedup, no speed up at all, and in many cases a degradation of speed (can you write code that is more optimal than the library writer?)Just use std::string and you don't worry about MFC.Quote:
I would try MFCs CString, but ... this means VC will link all the bloated MFC code into my program?
Regards,
Paul McKenzie
But there are advantages in using MFC's CString over std::string?
thank you.
What if I'm not using MFC, or VC++, or even running Windows? This is not only the case for std::string, but for all the container classes. You don't need MFC for container and string classes, period. Everything that the MFC container classes and string classes support, the standard library IMO does a much better job. You will also get the same reply from practically every expert who has dealt with MFC classes and the standard classes.Quote:
Originally posted by indiocolifa
But there are advantages in using MFC's CString over std::string?
thank you.
In all the coding that I've done that had used CString (this was years ago), I quickly and easily replaced all of it with std::string. Therefore, I see no advantages, and a whole lot of disadvantages of CString over std::string.
a) CString is proprietary to MFC. The std::strng is an ANSI standard C++ class and is supported by all ANSI compliant C++ compilers, regardless of operating system.
b) To use CString, you must either link in gobs of MFC code in your application or add the MFC DLL's to your application. With std::string, this is not necessary.
Too many programmers who are not using MFC in their apps automatically try to include MFC when they need a string or container class. I don't know if it's Microsoft brainwashing, or not having learned C++ from a good textbook as to why this phenomenon occurs, but it does happen (check out the VC++ Forum -- you'll find more than a dozen messages from people trying to include MFC in their non-MFC apps when they need a string, map, dynamic array, etc.)
Regards,
Paul McKenzie
all right... i will stick to ansi c++
recommend me please a good c++ book
bruce eckel´s "Thinking in C++" ??? this is a good book to buy?
http://www.codeguru.com/forum/showthread.php?s=&threadid=231039Quote:
Originally posted by indiocolifa
all right... i will stick to ansi c++
recommend me please a good c++ book
bruce eckel´s "Thinking in C++" ??? this is a good book to buy?
Add to that list "The C++ Standard Library" by Nicolai Josuttis.
Regards,
Paul McKenzie