[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 | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Oct 21, 2004
    #1
    1. Advertising

  2. Christopher Benson-Manica wrote:
    > My understanding is that the following program exhibited undefined
    > behavior until very recently:
    >


    So your understanding is that the program below used to have undefined
    behaviour, but not anymore? It is never or always usually. :p

    > #include <stdio.h>
    >
    > int main( void )
    > {
    > printf( "Red Sox win! Red Sox win!\n" );
    > return 0;
    > }
    >


    So, what is meant to be wrong with the above?

    --
    Thomas.
     
    Thomas Stegen, Oct 21, 2004
    #2
    1. Advertising

  3. Thomas Stegen wrote:
    > So, what is meant to be wrong with the above?


    Heh, forget it.

    --
    Jason Whitehurst
     
    Jason Whitehurst, Oct 21, 2004
    #3
  4. Christopher Benson-Manica

    Carlos Guest

    Thomas Stegen wrote:
    > Christopher Benson-Manica wrote:
    >
    >> My understanding is that the following program exhibited undefined
    >> behavior until very recently:
    >>

    >
    > So your understanding is that the program below used to have undefined
    > behaviour, but not anymore? It is never or always usually. :p
    >
    >> #include <stdio.h>
    >>
    >> int main( void )
    >> {
    >> printf( "Red Sox win! Red Sox win!\n" );
    >> return 0;
    >> }
    >>

    >
    > So, what is meant to be wrong with the above?
    >

    I think that it's a reference to one of those minority sports.
     
    Carlos, Oct 21, 2004
    #4
  5. Thomas Stegen wrote:
    >
    > Christopher Benson-Manica wrote:
    > > My understanding is that the following program exhibited undefined
    > > behavior until very recently:
    > >

    >
    > So your understanding is that the program below used to have undefined
    > behaviour, but not anymore? It is never or always usually. :p
    >
    > > #include <stdio.h>
    > >
    > > int main( void )
    > > {
    > > printf( "Red Sox win! Red Sox win!\n" );
    > > return 0;
    > > }
    > >

    >
    > So, what is meant to be wrong with the above?


    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
    #5
  6. Jason Whitehurst wrote:
    > Thomas Stegen wrote:
    >
    >>So, what is meant to be wrong with the above?

    >
    >
    > Heh, forget it.
    >


    I am a stonefaced engineer, I don't do jokes.

    --
    Thomas.
     
    Thomas Stegen, Oct 21, 2004
    #6
  7. On Thu, 21 Oct 2004 13:44:37 +0000, Christopher Benson-Manica wrote:

    > 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;
    > }

    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
    #7
  8. Christopher Benson-Manica

    Mike Wahler Guest

    "Thomas Stegen" <> wrote in message
    news:...
    > Christopher Benson-Manica wrote:
    > > My understanding is that the following program exhibited undefined
    > > behavior until very recently:
    > >

    >
    > So your understanding is that the program below used to have undefined
    > behaviour, but not anymore? It is never or always usually. :p
    >
    > > #include <stdio.h>
    > >
    > > int main( void )
    > > {
    > > printf( "Red Sox win! Red Sox win!\n" );
    > > return 0;
    > > }
    > >

    >
    > So, what is meant to be wrong with the above?


    Baseball fans will understand.

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

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

    Mike Wahler Guest

    "Nils O. SelÄsdal" <> wrote in message
    news:p...
    > On Thu, 21 Oct 2004 13:44:37 +0000, Christopher Benson-Manica wrote:
    >
    > > 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;
    > > }

    > It's not exactly undefined behaviour. It's just that the
    > string in the printf statement is invalid.\


    Not any more. :)

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

    Artie Gold Guest

    Christopher Benson-Manica wrote:
    > 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;
    > }
    >

    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.

    --ag

    [Did `No No Nanette' make any money?]

    --
    Artie Gold -- Austin, Texas

    "If you don't think it matters, you're not paying attention."
     
    Artie Gold, Oct 21, 2004
    #10
  11. Christopher Benson-Manica

    Eric Sosman Guest

    Mike Wahler wrote:
    > "Thomas Stegen" <> wrote in message
    > news:...
    >
    >>Christopher Benson-Manica wrote:
    >>
    >>>My understanding is that the following program exhibited undefined
    >>>behavior until very recently:
    >>>

    >>
    >>So your understanding is that the program below used to have undefined
    >>behaviour, but not anymore? It is never or always usually. :p
    >>
    >>
    >>>#include <stdio.h>
    >>>
    >>>int main( void )
    >>>{
    >>> printf( "Red Sox win! Red Sox win!\n" );
    >>> return 0;
    >>>}
    >>>

    >>
    >>So, what is meant to be wrong with the above?

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


    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
    #11
  12. Christopher Benson-Manica

    Richard Bos Guest

    Christopher Benson-Manica <> wrote:

    > 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;
    > }


    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
     
    Richard Bos, Oct 22, 2004
    #12
  13. Christopher Benson-Manica

    Alan Balmer Guest

    On Fri, 22 Oct 2004 07:45:15 GMT, (Richard
    Bos) wrote:

    >Christopher Benson-Manica <> wrote:
    >
    >> 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;
    >> }

    >
    >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.


    Come now, I think you have us outclassed with your soccer riots.

    >(And anyway, surely they didn't get to the semi-final by losing all
    >their previous games?)
    >
    >Richard


    --
    Al Balmer
    Balmer Consulting
     
    Alan Balmer, Oct 22, 2004
    #13
  14. In article <>, (Richard Bos) writes:
    >
    > 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.


    *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
     
    Michael Wojcik, Oct 22, 2004
    #14
  15. Christopher Benson-Manica

    Richard Bos Guest

    (Michael Wojcik) wrote:

    > In article <>, (Richard Bos) writes:
    > >
    > > 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.

    >
    > *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.


    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
     
    Richard Bos, Oct 25, 2004
    #15
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aka
    Replies:
    10
    Views:
    714
  2. REH
    Replies:
    25
    Views:
    837
    Victor Bazarov
    Mar 29, 2005
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,776
    Dan Pop
    Feb 17, 2004
  4. VK
    Replies:
    45
    Views:
    614
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    373
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page