Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!ames!elroy!spl1!laidbak!daveb From: daveb@laidbak.UUCP (Dave Burton) Newsgroups: comp.lang.c Subject: Re: QuickC Message-ID: <1628@laidbak.UUCP> Date: 29 Aug 88 13:53:08 GMT References: <8808261424.AA11504@ucbvax.Berkeley.EDU> Reply-To: daveb@laidbak.UUCP (Dave Burton) Organization: is pretty bad/My method of Lines: 26 In article <8808261424.AA11504@ucbvax.Berkeley.EDU> TURGUT@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.