Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!pacbell.com!att!cbnewsj!asd From: asd@cbnewsj.att.com (Adam S. Denton) Newsgroups: comp.lang.c Subject: Re: Borland Turbo C 2.0 for Atari 68000 machines: ODD behavior Message-ID: <1991Apr19.172024.10364@cbnewsj.att.com> Date: 19 Apr 91 17:20:24 GMT References: <1991Apr6.091013.26131@daffy.cs.wisc.edu> <690004@hplvec.LVLD.HP.COM> Organization: AT&T Lines: 36 In article <690004@hplvec.LVLD.HP.COM> boyne@hplvec.LVLD.HP.COM (Art Boyne) writes: >>In comp.lang.c, pardo@june.cs.washington.edu (David Keppel) writes: >> >> carter@cs.wisc.edu (Gregory Carter) writes: >> > (unsigned int)(*((unsigned int *)0xffff8e20L)) = 0x03; >> >translates to: >> > MOVE.W #$0003, $8e20 >> >This is obviously not correct. >> >> I'll agree that it isn't what I *expected* but it is *correct*. >> Here are some other correct implementations: >> >> * Compiler refuses to compile the program >> * Program aborts when executed >> * Program runs `rogue' >> * Program assigs 3 to memory location 0xffff8e20 > >You don't seem to understand: MOVE.W #$0003, $8e20, assuming that the He understands. This debate is apparently what assigning to a casted expression should do. The above is very clearly (cast) [something] = [some value]; which has never been defined to have any meaning whatsoever. Let's not forget what GIGO stands for! Now, consider rewriting that expression...instead of: >> > (unsigned int)(*((unsigned int *)0xffff8e20L)) = 0x03; Why not toss the (unsigned int) cast? What on earth is it there for anyway? Maybe it should be before the 0x03 instead, or left out entirely. If one removes the cast, *then* the statement has meaning, and ONLY then is there a platform on which to decide whether the compiler's correct or not. But as it stands, there's no reason why the statement *shouldn't* run `rogue'! Adam Denton asd@mtqua.att.com