Thread: Strangeness

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    What you need is a debugger, not fwrite or printf.
    Visual Studio has a nice debugger, and within its sortiment, it allows you to put breakpoints when a certain position in memory changes (in other words, you can have it break when your buffer is changed, or corrupted), to see what caused the change.
    It makes debugging so much easier.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Quote Originally Posted by pfs View Post
    The strange thing about this is that the process didn't crash. Shouldn't this be reason enough for the process to crash?
    Generally, no as the behavior is undefined; anything can happen. You're lucky if id does crash.

    However, it is possible to make it always crash with a good debugger which overwrites freed memory with very high or very low constants, such that dereferencing them would result in a segfault. Similarly global delete can be overridden to do the same thing.

    MS Visual Studio seems to have such a debugger.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Form.ShowDialog() strangeness
    By Elkvis in forum C# Programming
    Replies: 5
    Last Post: 01-18-2009, 02:00 PM
  2. Modem Driver Strangeness.
    By civix in forum Tech Board
    Replies: 1
    Last Post: 03-26-2006, 08:02 PM
  3. integer strangeness
    By lostminds in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2002, 01:04 AM