Re: low-level question
- From: phaywood@xxxxxxxxxxxxxxxxxxxxxxxx (Peter "Shaggy" Haywood)
- Date: Wed, 31 Aug 2005 01:41:50 GMT
Groovy hepcat jesso was jivin' on 30 Aug 2005 05:30:18 -0700 in
comp.lang.c.
low-level question's a cool scene! Dig it!
>I couldn't get this on a midterm. Darn!
Sure. And it's not your homework you want us to do for you, or
anything.
>Anyone want to help?
>
>1. Why does the following program output a 0?
For the same reason it might make the computer reach out and smack
you at any time.
>2. Explain in detail.
When you invoke undefined behaviour, anything is allowed to happen.
This includes the incredibly mundane, such as outputting 0, and the
downright bizzarre, like making the computer reach out and slap you.
>3. How could you prevent this outcome without changing the code?
Don't run the compiled program.
[Snip code invoking undefined behaviour.]
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
.
- References:
- low-level question
- From: jesso
- low-level question
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: Re: confused abt file operations
- Previous by thread: Re: low-level question
- Next by thread: Re: low-level question
- Index(es):