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
    Posts
    384

    undefined behaviour.

    Could the values of an undefined behaviour be predicted somehow?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,632
    No, but in practice, it depends, since a particular compiler may be known to do something for certain cases that result in undefined behaviour.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 11:44 AM
  2. Undefined behaviour telnet
    By stevesmithx in forum Tech Board
    Replies: 0
    Last Post: 04-22-2008, 01:41 AM
  3. bit shifting...undefined behaviour?
    By Sebastiani in forum C++ Programming
    Replies: 15
    Last Post: 11-07-2007, 01:11 PM
  4. Is this undefined behaviour?
    By caduardo21 in forum C Programming
    Replies: 4
    Last Post: 01-15-2006, 11:55 AM

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