Heap Corruption during run time. - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25

Thread: Heap Corruption during run time.

  1. #16
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,827

    Re: Heap Corruption during run time.

    but there's no reason why the java approach can't be applied to C++ just as easily. C++ viewn as just "C with objects", without the STL, without templates and without all the other things that separate it from it's granddaddy C (C++ has since evolved on it's own path not even following C anymore) is a concept that is outdated by many years now. THis might have been a useful approach when nobody knew C++ and C++ was still little more than a preprocessor for C. But it's gone way beyond that now.

    It's like teaching someone to drive a car... By first telling them how to tend to a horse and making them drive around in a horse carriage for a whole year.


    Even if you did teach the class by first teaching C, and then migrating over to C++, this assignment is bad because it makes not much sense if you look at it from a C p.o.v. and it's silly as a C++ p.o.v. because you're better off using STL.


    I'm not saying there is no merit to teaching someone how to write a container, but then you'd do this because you want to do something STL doesn't provide and even then you'd make sure that students know about ths STL approach to things, so that the container they need to design is usable with the rest of the STL algorithms etc. (hardly a beginners class but hey).

  2. #17
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,308

    Re: Heap Corruption during run time.

    but there's no reason why the java approach can't be applied to C++ just as easily.
    Agreed, but try getting the teachers to do this!

    PS I think the benefit of the java approach is starting to filter through as there is now an 'early object' version of the well known Deitel 'c++ How to program' book that also covers c++11 (although I haven't yet seen a copy so can't comment upon how good it is).

    http://www.amazon.co.uk/How-Program-...0008707&sr=1-2
    Last edited by 2kaud; May 31st, 2013 at 09:08 AM.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #18
    Join Date
    Apr 1999
    Posts
    27,424

    Re: Heap Corruption during run time.

    Quote Originally Posted by 2kaud View Post
    Agreed, but try getting the teachers to do this!
    Then you get those who will say "but C++ programmers who learn the "high-level" way without learning the low-level details first will not be good programmers".

    The problem with that statement is that this "C++ programmer who doesn't know low-level details" doesn't exist, or I have yet to meet such a programmer. It's plain foolish to think that a C++ programmer who knows how to use design patterns, STL, boost, MFC, etc. to structure a well-written, modular, easily maintained program can't manipulate a few pointers or know how to use char*, dynamically allocated memory, strcat or strcmp() properly.

    Regards,

    Paul McKenzie

  4. #19
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,308

    Re: Heap Corruption during run time.

    Quote Originally Posted by Paul McKenzie View Post
    Then you get those who will say "but C++ programmers who learn the "high-level" way without learning the low-level details first will not be good programmers".
    But if you are using c++ 'correctly' - ie high level - how often do you need the low-level detail? IMO if you are regularly using the 'low level detail' (unless you really are twiddling bits) then you are not using c++ properly.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #20
    Join Date
    Apr 1999
    Posts
    27,424

    Re: Heap Corruption during run time.

    Quote Originally Posted by 2kaud View Post
    But if you are using c++ 'correctly' - ie high level - how often do you need the low-level detail? IMO if you are regularly using the 'low level detail' (unless you really are twiddling bits) then you are not using c++ properly.
    I know. But you still get those responses from die-hards who believe that teaching low-level details should be done first.

    So the way I counter their argument is to show me this (mythical) C++ programmer who, if need be, can't write a module or get involved in some low-level coding. So far, no such programmer can be produced.

    Regards,

    Paul McKenzie

  6. #21
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,308

    Re: Heap Corruption during run time.

    qui docet doctores?
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  7. #22
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: Heap Corruption during run time.

    Frankly guys, how is the OP to benefit from the last posts? I feel that many threads ends up in a a lot of posts that blame the teachers of teaching the wrong stuff and giving the wrong type of excercises but that's not what the board is about is it? Shouldn't every post be focused on trying to help the OP the best we can?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  8. #23
    Join Date
    Apr 1999
    Posts
    27,424

    Re: Heap Corruption during run time.

    Quote Originally Posted by S_M_A View Post
    Frankly guys, how is the OP to benefit from the last posts? I feel that many threads ends up in a a lot of posts that blame the teachers of teaching the wrong stuff
    I'm still waiting for the OP to post the other functions instead of descriptions of what he/she did. That is what I asked for, and so far, nothing.

    Also, a test program to see how these classes and functions are being used and called wasn't posted so we see what the flow was that ultimately led to the crash.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; May 31st, 2013 at 06:37 PM.

  9. #24
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,067

    Re: Heap Corruption during run time.

    Quote Originally Posted by Paul McKenzie View Post
    I'm still waiting for the OP to post the other functions instead of descriptions of what he/she did. That is what I asked for, and so far, nothing.

    Also, a test program to see how these classes and functions are being used and called wasn't posted so we see what the flow was that ultimately led to the crash.

    Regards,

    Paul McKenzie
    I agree with S_M_A. Railing against the nature of the assignment doesn't really help the student. We who have been doing it for a while, know how goofy some of these assignments are, but the student is still required to implement them.

    Regardless, I pointed out what I think is the likely cause in post #2. It would be kind of nice if the OP would comment on that.

  10. #25
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: Heap Corruption during run time.

    Maybe we should ask for a "What C++ teachers should teach and why" forum (and of course the other langauges as well)? After all, we all do represent the industry and we do know what we want people that just graduated to know.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center