|
-
September 26th, 2003, 10:44 PM
#16
darwen using the STL (and especially the vector class instead of a linked list or something) will actually help cut DOWN on issues such as memory leaks. that said, they're just a part of programming and can still be dealt with.
use the stl, it's a tool. a good one.
-
September 26th, 2003, 10:51 PM
#17
R. Thomas
"Be anxious for nothing, but in everything by prayer and supplication, with thanksgiving, let your requests be made know to God; and the peace of God, which surpasses all understanding, will guard your hearts and minds through Christ Jesus."Philippians 4:6-7
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
September 26th, 2003, 10:57 PM
#18
Originally posted by darwen
Right : I know I'm going to be flamed for saying this but ....
Why are you using STL ?
Standard debugging of memory leaks in VC doesn't work with STL which means tracking them down is a nightmare.
There are plenty of classes in MFC which will do the same job.
Hmmm, I feel another thread coming on...
Darwen.
I get memory leaks so very, very, very seldom that I have no fear of them. Perhaps it is use of things such as the C++ standard classes that I rarely have memory leaks.
-
September 26th, 2003, 11:11 PM
#19
The STL is a coders greatest ally in the prevention of memory leaks. That and not being a sloppy and lazy programmer.
STL OR DIE!!!!!
DEFENDER OF ALL THINGS STL!!!
-
September 26th, 2003, 11:13 PM
#20
Originally posted by STL MAN
The STL is a coders greatest ally in the prevention of memory leaks. That and not being a sloppy and lazy programmer.
STL OR DIE!!!!!
cool dude...had too much STTL in the mornin' huh?
R. Thomas
"Be anxious for nothing, but in everything by prayer and supplication, with thanksgiving, let your requests be made know to God; and the peace of God, which surpasses all understanding, will guard your hearts and minds through Christ Jesus."Philippians 4:6-7
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
September 27th, 2003, 01:03 AM
#21
Eerrr - what do you mean by that ?
If you mean that you can use vectors, then ok. But I have my own classes to do all of that anyway and they are all derived from MFC.
So in my opinion disadvantages of STL -
(1) It doesn't look very nice (if you look at STL-code and the equivalent non-STL then the STL looks really messy).
(2) Can't do memory tracking etc on it.
(3) Can't inherit which means going around the houses most of the time.
Advantages of STL :
(1) Sorting.
(2) Lower (not by much in my opinion but there you go) overhead since no inheritance from CObject.
Sorry, I didn't intend for this to turn into a flaming match. I meant for it to be a real discussion of the pros and cons of STL Vs MFC. My opening statement was intended to be antagonistic but that was to get it going.
In the end this isn't really going to change anything. You'll still use STL and I'll still use MFC because we'll both be using tools we like.
In fact its rather nice that we do have a choice don't you think ?
Darwen.
-
September 27th, 2003, 01:07 AM
#22
Oh and saying that 'I rarely get memory leaks' is fine. But what happens when you DO get one ?
I also write all by code in a constructor/destructor way and rarely get memory leaks.
But on the occasions that I do it's really, really nice that I can track down where they are and nuke them.
You do not have the option.
Darwen.
-
September 27th, 2003, 08:51 AM
#23
Okay...since we are far way from the original topic here already, I would kindly like to ask everybody to post relevant opinions to the discussion STL vs. MFC in the dedicated thread...
Thank you very much.
-
September 27th, 2003, 02:25 PM
#24
Originally posted by darwen
You do not have the option.
I don't need it.
-
September 27th, 2003, 02:45 PM
#25
Originally posted by darwen
(2) Can't do memory tracking etc on it.
(Darwen.
I've already asked you why you think this is so in your other thread, maybe you should step into the MFC code and see what it acutally uses to track memory leaks, maybe it will open your eyes to the fact that MFC's memory tracking uses the CRT. Maybe you should look a little deeper than just MFC. And BTW it's overkill, 2 lines of CRT calls, 1 macro, and that's all I need to find memory leaks (ok maybe 1 more when I do find one that falls into malloc/free)...
So please expand on your #2 cause I have the TP handy
-
September 27th, 2003, 06:33 PM
#26
Originally posted by darwen
But I have my own classes to do all of that anyway and they are all derived from MFC.
And they have not been peer-reviewed by ANSI, so why should any of us use them? How do we know your classes aren't full of bugs? Are you now saying that Joseph (the OP) should start using your classes (or code his own)? You are talking about the merits of MFC, and then you state that you still need to write your own functions -- more code to maintain, more potential bugs.
Also, I highly doubt that the number of functions you have written come anywhere close to what is provided by the STL container and algorithm functions.
So in my opinion disadvantages of STL -
(1) It doesn't look very nice (if you look at STL-code and the equivalent non-STL then the STL looks really messy).
As I stated before, the problem that you are having doesn't seem to be STL, but template syntax in general. You can code a non-STL application, and it will look messy to you since it may use templates.
(2) Can't do memory tracking etc on it.
Why would you need memory tracking for the STL containers? The containers already work. The only memory tracking you would need would be on your own classes.
(3) Can't inherit which means going around the houses most of the time.
I don't know what you mean by "going around the house". Ever hear of generic programming? You don't accomplish that by inheritance, but by template programming.
Advantages of STL :
(1) Sorting.
Sorting is just one example. Have you seen the list of algorithm functions? How about searching? How about calling a function on all elements of the container? MFC has no such functions. Have you ever used iterators? I think you need to take a look at STL in its entirety.
Sorry, I didn't intend for this to turn into a flaming match. I meant for it to be a real discussion of the pros and cons of STL Vs MFC
This has been rehashed time and again on different forums. MFC (in terms of the container classes) has always been deemed inferior to STL by most, if not all, C++ professionals who have name recognition. Sorry, but that's the consensus.
Regards,
Paul McKenzie
-
September 28th, 2003, 04:46 AM
#27
As mentioned...we are far way from the original topic here already, so the discussion about STL and MFC can be continued in the dedicated thread...
Thread is closed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|