QuickC
Dave Burton
daveb at laidbak.UUCP
Mon Aug 29 23:53:08 AEST 1988
In article <8808261424.AA11504 at ucbvax.Berkeley.EDU> TURGUT at TREARN.BITNET (Turgut Kalfaoglu) writes:
|[in QuickC]
|square(num) int num; { num = num*num; }
|
|...I get '4' as an answer...[then I tried]
|
|square(num)
|int num;
|{
| int dummy;
| num = num*num;
| dummy=222;
|}
|
|but the call STILL works... Can anyone shed some light onto this?
|WHY does it work?
The result of the _calculation_ was placed into the register used to
return the value to the caller (ax?). The addition of the _assignment_
did not have to disturb this register. Try using "dummy=222*num;" instead.
This will force another calculation, and should overwrite the `correct'
result.
--
Dave Burton | ``/* You are not expected to understand this. */''
{spl1,sun}!laidbak!daveb|
(312) 505-9100 x325 | Disclaimer: I channel only for myself.
More information about the Comp.lang.c
mailing list