Click here to Skip to main content
14,641,924 members

Comments by Theo Buys (Top 7 by date)

Theo Buys 7-Aug-19 5:37am View
   
Tanks for your solution. There are still some minor bugs in your example code: change TCHAR lpszParse into const TCHAR* lpszParse and change m_bHelp into m_bHelpParam. Also CMyCommandLineInfo don't match with CMyCmdLineInfo.
Theo Buys 5-Apr-17 11:20am View
   
Time is on my side. Why nobody has aswerwerd this nice question?
Theo Buys 2-Dec-16 4:02am View
   
Thanks!
Theo Buys 2-Dec-16 1:28am View
   
yes, right! I must say:
3) The size of an object of a class depends on the class variables and not the size of the memberfunctions code.
Theo Buys 1-Dec-16 11:10am View
   
Now forget all about allocating objects in the member functions. Lets look only at the class variables and the supporting member functions.

1) If allocate the object of the class on the heap, then the class and its variables are on the heap but if I run a memberfunction it uses the stack for its local variables and only the heap for the class variables.

2) If create the object of the class on the stack, then the class and its variables are on the stack and if I run a memberfunction it uses the stack for both its local variables and the class variables.

3) The size of a class depends on the class variables and not the size of the memberfunctions code.
Theo Buys 23-Nov-16 11:52am View
   
So, the pointer heapVar is on the stack while the memory for the int[20] is on the heap. The pointer goes out of scope but the memory remains. I think that this proofs that memberfunctions of a heap allocated object are not part of that allocation but only the data and not the local data used in the member functions. The use of heapvar in the example is a kind of wild west and not part of the class data. This way the object creates memory leaks.
Theo Buys 25-Nov-13 9:12am View
   
Yes, a tree structure is here the best solution. Because you program in plain C, read about "Self-referential structures" in the C programming language by Kernighan and Ritchie. Put you words one by one into the tree. Your search function walks the tree to a node and complete the words from that node to the leaves.