Click here to Skip to main content
14,661,292 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
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
mveRichard MacCutchan19-Jun-19 21:07 
GeneralRe: CStringList on heap Pin
Stefan_Lang19-Jun-19 23:20
mveStefan_Lang19-Jun-19 23:20 
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
mveStefan_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
mveStefan_Lang20-Jun-19 21:43 
_Flaviu wrote:
... if this member has a lot of elements

Just to make a point: the elements of a container do not affect how the container itself looks like, or how it should be allocated. This is true for all STL containers, and also for CStringList.

Containers are typically designed like this: one central data structure to store the basic info about the container, and maybe it's state, and some kind of reference (or two) to the data structure(s) containing the elements. The container will take care about allocating memory for the elements on the heap. But the central structure will never need to be reallocated, nor is it very large. Therefore it is no problem at all to allocate a container on the stack.

That said, if you pass a container to a function, you should normally pass it by reference. If you don't, the container will be copied as a whole, including all the elements!
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
_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
professionalEddy 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
mveRichard 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
mveRichard 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
mveRichard 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
mveRichard 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 
GeneralRe: getchar / putchar - how does it really works ? Pin
k505415-Jun-19 9:07
mvek505415-Jun-19 9:07 
GeneralRe: getchar / putchar - how does it really works ? Pin
Richard MacCutchan16-Jun-19 3:02
mveRichard MacCutchan16-Jun-19 3:02 
GeneralRe: getchar / putchar - how does it really works ? Pin
leon de boer16-Jun-19 5:43
Memberleon de boer16-Jun-19 5:43 
GeneralRe: getchar / putchar - how does it really works ? Pin
Richard MacCutchan16-Jun-19 5:48
mveRichard MacCutchan16-Jun-19 5:48 

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.