Author Topic: CString vs STL wstring  (Read 3537 times)

0 Members and 1 Guest are viewing this topic.

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 659
CString vs STL wstring
« on: December 07, 2014, 02:55:37 PM »
Patrice,

  What were your reasons on using STL strings instead of native VC++ CString?

James
« Last Edit: December 07, 2014, 02:57:30 PM by James C. Fuller »

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1996
    • www.zapsolution.com
Re: CString vs STL wstring
« Reply #1 on: December 08, 2014, 03:17:21 PM »
Most of the time i am using UNICODE in C++, aka wstring or WCHAR.

WSTRING is for the ease of use, but dealing directly with WCHAR produces smallest code.

And i don't want to use ATL/MFC to reduce the size of the embedded CRT.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 659
Re: CString vs STL wstring
« Reply #2 on: December 08, 2014, 04:07:36 PM »
Patrice,
  That's a big DUH on my part.
I've been spending way too many hours trying to get a handle on mfc, forgetting that CString is in fact part of mfc.

James

Offline Frederick J. Harris

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 937
    • Frederick J. Harris
Re: CString vs STL wstring
« Reply #3 on: December 09, 2014, 03:24:32 PM »
Do you really like MFC James?  If you were to come into my house and look at computer programming books lying around, you would think I'm huge into .NET and MFC.  But the sad fact is that the reason I have so many books on those subjects is because I found them so difficult and problematic.   

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 659
Re: CString vs STL wstring
« Reply #4 on: December 09, 2014, 05:24:03 PM »
Fred,
  I like the concept of the mfc but the implementation via Visual Studio completely turns me off.
Way too many hidden items going on in the background. The biggest problem I have found is finding demos that will load with Visual Studio 2013 Community.
I am understanding it bit by bit but am coming to the conclusion that gui encapsulation can be better served with wxWidgets.
The App's will be bigger than mfc but ....
WxWidgets has a nice grid. I could not find a "free" mfc grid that measures up to it.
I don't have a working VC++ <-> wxWidgets setup to test even though I do have the VC++ libraries.
I still think one is better off using TDM-GCC with wxWidgets just in case there is Linux in their future.
It's a rock solid distro that I believe was used to build code:blocks.

James
 

Offline Frederick J. Harris

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 937
    • Frederick J. Harris
Re: CString vs STL wstring
« Reply #5 on: December 09, 2014, 07:03:35 PM »
Quote
Way too many hidden items going on in the background.

That was exactly my impression also.  All those confusing macros doing things like setting up message handlers and so forth.  I do have several decent MFC books (old) I'd be happy to give you if you would help with the shipping.  I really don't see myself getting interested in it again.  Back in the late 90's I was though.  The big heavy book is Jeff Procesis or something like that from Microsoft Press.  Then I have a couple others too.

If I was into Linux I believe I'd look into wxWidgets.  The last coding I was doing in Linux was with GTK.

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 659
Re: CString vs STL wstring
« Reply #6 on: December 09, 2014, 07:50:05 PM »
Fred,
  Thanks for the offer but I picked up Jeff's book (used) for just a few bucks on Amazon.
I also had an old SAM's teach yourself Visual C++ 6 in a half hour :)
I did find another pdf on line that also helped a bit.
They all focus (as they should) on the Visual Studio VC++ implementation. I have been able to learn quite a bit from reading a lot of the VS log output files.
I have a lot of working code bc9Basic -> c++  compiled with a new batch file just for VS 2013 Community mfc.

I have looked at other Frameworks Win32++ for instance but I think wxWidgets is good even if you have no interest in Linux.
Qt is another VERY popular Framework.

Yes it all can be done without a Framework but I like the encapsulation using much better code than I could ever write.

Also I have my UbxWx translator for both Windows and Linux 32/64. Sorry couldn't help the plug :)

James


Offline Brian Alvarez

  • Jr. Member
  • **
  • Posts: 55
    • PluriBASIC
Re: CString vs STL wstring
« Reply #7 on: March 07, 2018, 05:28:08 AM »
This is very interesting stuff!!. Do you think it would be possible for you to make a post about BSTR's?

:)
« Last Edit: March 07, 2018, 05:29:57 AM by Brian Alvarez »