d83_sven_a@tekno.chalmers.se (Sven (Sciz) Axelsson) (04/23/89)
Am I really out of line, or is this a true-to-God bug in the final release of MPW C 3.0?? Isn't this code supposed to assign the integer value contained at memory position 10 to the variable x? x = *((int *)10); In MPW C 3.0 this generates exactly the same code as would x = 10. Am I right or am I right? Sven Axelsson d83_sven_a@tekno.chalmers.se
darin@Apple.COM (Darin Adler) (04/24/89)
In article <713@tekno.chalmers.se> d83_sven_a@tekno.chalmers.se (Sven (Sciz) Axelsson) writes: > Am I really out of line, or is this a true-to-God bug in the final release > of MPW C 3.0?? Isn't this code supposed to assign the integer value contained > at memory position 10 to the variable x? > > x = *((int *)10); > > In MPW C 3.0 this generates exactly the same code as would x = 10. > Am I right or am I right? Yes, the code should get the value contained at memory position 10. When I compiled the sequence of code with MPW C 3.0 it generated move.l $a,d7 This gets the value contained at memory position 10. x = 10 would generate moveq.l #$a,d7 instead. (Note the # means immediate mode.) -- Darin Adler, System Software Scapegoat, Apple Computer Internet: darin@Apple.com UUCP: {nsc,sun}!apple!darin
ech@pegasus.ATT.COM (Edward C Horvath) (04/25/89)
From article <713@tekno.chalmers.se>, by d83_sven_a@tekno.chalmers.se (Sven (Sciz) Axelsson): > Am I really out of line, or is this a true-to-God bug in the final release > of MPW C 3.0?? Isn't this code supposed to assign the integer value contained > at memory position 10 to the variable x? > x = *((int *)10); > In MPW C 3.0 this generates exactly the same code as would x = 10. > Am I right or am I right? If you were right, then yes, perhaps you're right. But I fed MPW C 3.0 the following: int x,y; foo() { x = 10; y = *((int *) 10); } I then ran dumpobj on the resulting .c.o; it reported, in part, LINK A6,#$0000 MOVEQ #$0A,D0 MOVE.L D0,x ; id: 4 MOVE.L $000A,y ; id: 3 UNLK A6 RTS which looks fine to me. Efficient, no; correct, yes. =Ned Horvath=