Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Is this broken or wot? |
| Date | 2012-02-13 12:59 -0800 |
| Organization | None to speak of |
| Message-ID | <lnsjieih4v.fsf@nuthaus.mib.org> (permalink) |
| References | <jhbm7t$9ng$1@speranza.aioe.org> |
Robert Samelson <robs@invalid.com> writes:
> unsigned x = 0;
> if(x-- < 4)
> printf("foo\n");
> else
> printf("bar\n");
>
> GCC for Data General Aviion 5000 (an 88000 machine) will convert this
> into:
>
> unsigned x = 0;
> if(--x < 3) ....
>
> in the assembly.
>
> This seems broken if x == ~0.
It's broken if and only if the program produces incorrect output. C
code specifies behavior, not machine code.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is this broken or wot? Robert Samelson <robs@invalid.com> - 2012-02-13 18:53 +0000
Re: Is this broken or wot? Willem <willem@toad.stack.nl> - 2012-02-13 19:19 +0000
Re: Is this broken or wot? Barry Schwarz <schwarzb@dqel.com> - 2012-02-13 12:14 -0800
Re: Is this broken or wot? James Kuyper <jameskuyper@verizon.net> - 2012-02-13 15:40 -0500
Re: Is this broken or wot? Keith Thompson <kst-u@mib.org> - 2012-02-13 12:59 -0800
Re: Is this broken or wot? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-02-13 14:30 -0800
Re: Is this broken or wot? "Bl0ckeduser ." <bl0ckedusersoft@gmail.com> - 2012-02-13 18:13 -0800
csiph-web