Re: complier problem
- From: Chris Torek <nospam@xxxxxxxxx>
- Date: 29 Jul 2006 08:01:35 GMT
Chris Torek wrote:
[the compiler can produce varying machine code for the C source:]
save = p++;
In article <r9ydnT3pDI-RaFfZnZ2dnUVZ_sGdnZ2d@xxxxxxxxxxx>,
Ark <akhasin@xxxxxxxxxxxxxxxxxxxx> wrote:
Looks like a storm in a teacup. ['save' doesn't have to exist at all,
depending on the instruction set,
The intent of this later example -- which I admit is not clear if
you follow the whole thread and think that it is *not* a separate
example -- is that the "save = p++;" is a complete line of C source
code. Hence "save" *does* exist, right there in the source code. :-)
and *p++=c; may execute in a single instruction]
On some architectures (try it on a SPARC or MIPS!); but this is a
different line of source code anyway. :-) And of course, while a
number of architectures have a single instruction that implements
"*p++ = expr" and "*--p = expr", many of those do not have a single
instruction that implements "*++p = expr" or "*p-- = expr". (But
some do.)
p++ has a value (old p) and a side effect (p = old p + 1).
*p++ dereferences the value of p++ (old p).
(Correct -- but can you say that in no fewer than 1000 words? :-) )
I'd care about implementation only when shopping for a compiler (or
squeezing out that last optimization)
Indeed, this is an appropriate attitude.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
.
- References:
- complier problem
- From: neha
- Re: complier problem
- From: Andrey Tarasevich
- Re: complier problem
- From: Chris Torek
- Re: complier problem
- From: Ark
- complier problem
- Prev by Date: Re: The C language in the planet Mars
- Next by Date: Re: structure malloc help
- Previous by thread: Re: complier problem
- Next by thread: Re: complier problem
- Index(es):
Relevant Pages
|