Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CString - string / BOOL - bool

32 views
Skip to first unread message

Hans-Peter Haberlandner

unread,
Oct 7, 1998, 3:00:00 AM10/7/98
to
We are still using VC++ 5.0.
Is there any simple strategie when to use MFC or STL? Are there any
changes in 6.0 eg. support to convert CString to string and vice versa?

Thanx
Hans-Peter
--
+---------------------------------------------------------------------+
| Hans-Peter Haberlandner mailto:ha...@technodat.co.at |
| Technodat CAD/CAM Systeme fuer Moebel Phone: ++43-(0)662-454944-0 |
| Jakob-Haringer-Strasse 6 fax: ++43-(0)662-454944-9 |
| A-5020 Salzburg / Austria http://www.technodat.co.at/ |
+---------------------------------------------------------------------+

willia...@firstdatacorp.com

unread,
Oct 7, 1998, 3:00:00 AM10/7/98
to
In article <361B864B...@technodat.co.at>,

Hans-Peter Haberlandner <ha...@technodat.co.at> wrote:
> We are still using VC++ 5.0.
> Is there any simple strategie when to use MFC or STL?

If it's an MFC class, stick with MFC types (though some of the STD containers
are more powerful and might be used in place of the MFC variety). If it's a
class that could be used in non-MFC projects, don't use the MFC types.

> Are there any changes in 6.0 eg. support to convert CString to string and
> vice versa?

Why would there be?

CString cstr;
string str;
cstr = "Hello";
str = cstr; // assuming non-unicode
str += " World";
cstr = str.c_str();

What would be simpler then the above?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

Martin Wawrusch

unread,
Oct 7, 1998, 3:00:00 AM10/7/98
to
Hans-Peter Haberlandner schrieb in Nachricht
<361B864B...@technodat.co.at>...

>We are still using VC++ 5.0.
>Is there any simple strategie when to use MFC or STL? Are there any

>changes in 6.0 eg. support to convert CString to string and vice versa?
>
>Thanx
>Hans-Peter
>--


In general you should use CString within an mfc app. You can, if you
absolutely need to, subclass CString and add your own functions (you will
have to define a few conversion operators though). I use string and
_bstr.... in all our atl projects.

"bool" is another story. I personally prefer to use bool instead of BOOL
except for members that need to be serialized.

The collection classes are a different story. I have used the MFC classes in
our larger projects (450 classes + libs right now) because of the built in
serialization support. Today I would go with stl and add a few helpers for
serialization and other common stuff.

CString to string should be pretty automatic (just assign it, maybe you need
a GetBuffer).

HTH

Martin

PS : Ist bei Euch das Wetter auch so lausig wie bei uns in Wien?


0 new messages