Like Tree1Likes
  • 1 Post By Salem

undefined behaviour.

This is a discussion on undefined behaviour. within the C Programming forums, part of the General Programming Boards category; Could the values of an undefined behaviour be predicted somehow?...

  1. #1
    Registered User
    Join Date
    Aug 2011

    undefined behaviour.

    Could the values of an undefined behaviour be predicted somehow?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    No, but in practice, it depends, since a particular compiler may be known to do something for certain cases that result in undefined behaviour.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Join Date
    Aug 2010
    Ontario Canada
    Plus the little problem that if something is undefined, it may work perfectly on one compiler but fall flat on it's face on another...
    A better name might be "unpredictable behaviour"...

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > Could the values of an undefined behaviour be predicted somehow?
    What did you have in mind - tea leaves, crystal ball, tarot cards, chicken entrails....

    It's a pointless excercise; whatever it is you think you "know" about the undefined behavior is immediately invalidated with the next edit or the next compile.

    Just look at how much "fun" there is to be had, even with simple programs. Using visual studio would really keep you on your toes!

    Here's another term for it.
    Cargo cult programming - Wikipedia, the free encyclopedia
    chibi.coder likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Does the following code show undefined behaviour ?
    By manasij7479 in forum C++ Programming
    Replies: 32
    Last Post: 10-15-2011, 12:44 PM
  2. Undefined behaviour telnet
    By stevesmithx in forum Tech Board
    Replies: 0
    Last Post: 04-22-2008, 02:41 AM
  3. bit shifting...undefined behaviour?
    By Sebastiani in forum C++ Programming
    Replies: 15
    Last Post: 11-07-2007, 02:11 PM
  4. Is this undefined behaviour?
    By caduardo21 in forum C Programming
    Replies: 4
    Last Post: 01-15-2006, 12:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21