Click here to Skip to main content
14,265,748 members

C / C++ / MFC

 
QuestionCStringList on heap Pin
_Flaviu18-Jun-19 23:38
member_Flaviu18-Jun-19 23:38 
QuestionRe: CStringList on heap Pin
CPallini19-Jun-19 2:19
mveCPallini19-Jun-19 2:19 
AnswerRe: CStringList on heap Pin
_Flaviu19-Jun-19 19:36
member_Flaviu19-Jun-19 19:36 
GeneralRe: CStringList on heap Pin
CPallini20-Jun-19 4:49
mveCPallini20-Jun-19 4:49 
AnswerRe: CStringList on heap Pin
Maximilien19-Jun-19 3:43
memberMaximilien19-Jun-19 3:43 
GeneralRe: CStringList on heap Pin
_Flaviu19-Jun-19 19:38
member_Flaviu19-Jun-19 19:38 
GeneralRe: CStringList on heap Pin
Richard MacCutchan19-Jun-19 21:07
protectorRichard MacCutchan19-Jun-19 21:07 
GeneralRe: CStringList on heap Pin
Stefan_Lang19-Jun-19 23:20
memberStefan_Lang19-Jun-19 23:20 
In my experience, if there is a class for your purpose to be found in STL, then it's much better to use that than a corresponding MFC class. The only exception is when you need the MFC structure to interface with a function from a third party library. (e. g. to pass it as a function argument)

The 'plus' is that
- you could port the code to any platform that does not have or use MFC
- you can use other third party libraries that don't use MFC (e. g. most third party libraries using strings in their API will use std::string, not CString)
- it's easy to find plenty of documentation and tutorials on the web, and they are all accurate, because existing behaviour of STL types never changes
- the types and functions will work very efficiently and not carry around needless ballast related to Windows stuff
- your global namespace doesn't get cluttered with symbols and macros
- you don't suffer from header dependencies, and don't need to care about order of include statements

The 'minus' is that
- for some types the STL equivalent provides less utility functions (e. g. std::string vs. CString)
- if you're already using MFC types elsewhere and don't intend to change all of them, you may need to convert data between MFC- and non-MFC types.


As for using std::vector instead of std::list, the reason is that as long as you don't delete items in the mid or at the start of the vector, it is much faster than a list.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

GeneralRe: CStringList on heap Pin
jschell23-Jun-19 5:54
memberjschell23-Jun-19 5:54 
GeneralRe: CStringList on heap Pin
Stefan_Lang23-Jun-19 21:02
memberStefan_Lang23-Jun-19 21:02 
GeneralRe: CStringList on heap Pin
CPallini20-Jun-19 4:50
mveCPallini20-Jun-19 4:50 
AnswerRe: CStringList on heap Pin
Stefan_Lang20-Jun-19 21:43
memberStefan_Lang20-Jun-19 21:43 
GeneralRe: CStringList on heap Pin
_Flaviu20-Jun-19 23:43
member_Flaviu20-Jun-19 23:43 
QuestionRFX_Date throwing "Datetime field overflow" exception after changing to ODBC Driver 13 for SQL Server Pin
Member 1106593318-Jun-19 8:04
memberMember 1106593318-Jun-19 8:04 
QuestionRe: RFX_Date throwing "Datetime field overflow" exception after changing to ODBC Driver 13 for SQL Server Pin
Eddy Vluggen18-Jun-19 8:16
mveEddy Vluggen18-Jun-19 8:16 
QuestionRe: RFX_Date throwing "Datetime field overflow" exception after changing to ODBC Driver 13 for SQL Server Pin
David Crow18-Jun-19 9:04
memberDavid Crow18-Jun-19 9:04 
AnswerRe: RFX_Date throwing "Datetime field overflow" exception after changing to ODBC Driver 13 for SQL Server Pin
Richard MacCutchan18-Jun-19 9:39
protectorRichard MacCutchan18-Jun-19 9:39 
GeneralRe: RFX_Date throwing "Datetime field overflow" exception after changing to ODBC Driver 13 for SQL Server Pin
Member 1106593318-Jun-19 10:38
memberMember 1106593318-Jun-19 10:38 
GeneralRe: RFX_Date throwing "Datetime field overflow" exception after changing to ODBC Driver 13 for SQL Server Pin
Richard MacCutchan18-Jun-19 11:41
protectorRichard MacCutchan18-Jun-19 11:41 
QuestionManifest for DPI awareness. Pin
Maximilien17-Jun-19 9:25
memberMaximilien17-Jun-19 9:25 
AnswerRe: Manifest for DPI awareness. Pin
Richard MacCutchan17-Jun-19 20:50
protectorRichard MacCutchan17-Jun-19 20:50 
GeneralRe: Manifest for DPI awareness. Pin
Maximilien18-Jun-19 4:42
memberMaximilien18-Jun-19 4:42 
Questiongetchar / putchar - how does it really works ? Pin
Vaclav_15-Jun-19 6:49
memberVaclav_15-Jun-19 6:49 
AnswerRe: getchar / putchar - how does it really works ? Pin
Richard MacCutchan15-Jun-19 7:03
protectorRichard MacCutchan15-Jun-19 7:03 
GeneralRe: getchar / putchar - how does it really works ? Pin
Vaclav_15-Jun-19 8:34
memberVaclav_15-Jun-19 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.