[OT] Undefined behavior?

Discussion in 'C Programming' started by Christopher Benson-Manica, Oct 21, 2004.

  1. My understanding is that the following program exhibited undefined
    behavior until very recently:

    #include <stdio.h>

    int main( void )
    printf( "Red Sox win! Red Sox win!\n" );
    return 0;
    Christopher Benson-Manica, Oct 21, 2004
    1. Advertisements

  2. So your understanding is that the program below used to have undefined
    behaviour, but not anymore? It is never or always usually. :p
    So, what is meant to be wrong with the above?
    Thomas Stegen, Oct 21, 2004
    1. Advertisements

  3. Heh, forget it.
    Jason Whitehurst, Oct 21, 2004
  4. Christopher Benson-Manica

    Carlos Guest

    I think that it's a reference to one of those minority sports.
    Carlos, Oct 21, 2004
  5. He forgot to include:

    volatile long shot;

    | Kenneth J. Brody | www.hvcomputer.com | |
    | kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
    Don't e-mail me at: <>
    Kenneth Brody, Oct 21, 2004
  6. I am a stonefaced engineer, I don't do jokes.
    Thomas Stegen, Oct 21, 2004
  7. It's not exactly undefined behaviour. It's just that the
    string in the printf statement is invalid.
    =?iso-8859-1?q?Nils_O=2E_Sel=E5sdal?=, Oct 21, 2004
  8. Christopher Benson-Manica

    Mike Wahler Guest

    Baseball fans will understand.

    Christopher seems to be trying to display the euphoria he
    shares with many, while also trying to stay topical. :)

    Mike Wahler, Oct 21, 2004
  9. Christopher Benson-Manica

    Mike Wahler Guest

    Not any more. :)

    Mike Wahler, Oct 21, 2004
  10. Christopher Benson-Manica

    Artie Gold Guest

    Not at all.

    Now if you make that printf:

    printf( "Red Sox World Champs!\n" );

    nasal demons might ensue. Or might not. We'll see.


    [Did `No No Nanette' make any money?]
    Artie Gold, Oct 21, 2004
  11. Christopher Benson-Manica

    Eric Sosman Guest

    For still greater topicality, here's a new version
    of an old, familiar program:

    #include <stdio.h>
    int main(void) {
    printf ("Hello, World Series!\n");
    return "Yankees win" == "sure thing";
    Eric Sosman, Oct 21, 2004
  12. Christopher Benson-Manica

    Richard Bos Guest

    Nope. It printed a line of text which is just as relevant to the real
    world as "Hello, world!". It never ceases to amuse me how you USAliens
    can get even more worked up about a game of rounders than my compatriots
    get about chasing an inflated bladder.
    (And anyway, surely they didn't get to the semi-final by losing all
    their previous games?)

    Richard Bos, Oct 22, 2004
  13. Christopher Benson-Manica

    Alan Balmer Guest

    Come now, I think you have us outclassed with your soccer riots.
    Alan Balmer, Oct 22, 2004
  14. *More* worked up? Perhaps US beats the Netherlands, but for some
    parts of Europe I think the football hooligans still have the edge
    over us. (And even if they didn't, football fans in other parts of
    the world have shown considerably more craziness that fans of any
    major US sport. Bulgatz documents South American and African wars
    started over football games, in his _Ponzi Schemes, Invaders from
    Mars, and More Extraordinary Popular Delusions and the Madness of
    Crowds_, which despite the bulky title is a fine sequel of sorts to
    Mackay's classic. I suspect US fans are in the main too fat and lazy
    to get a good riot up.)
    Michael Wojcik, Oct 22, 2004
  15. Christopher Benson-Manica

    Richard Bos Guest

    Well, imprimis, it seems your baseball hooligans are quite capable of
    causing unpleasant riots themselves, and secundis I wasn't really
    talking about the idiots who call themselves fans but do nothing but
    cause aggro, but about the _real_ fans. I've never seen any of those
    post to usenet with a club .sig (though they probably do in sports
    groups), but recently I've spotted several Sox fans who can't control
    their excitement even in completely unrelated groups.
    Now, I can understand _why_ they're excited. I mean, it's almost like
    England winning a major football tournament...

    Richard Bos, Oct 25, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.