Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!decwrl!shlump.nac.dec.com!tkou02.enet.dec.com!diamond From: diamond@tkou02.enet.dec.com (diamond@tkovoa) Newsgroups: comp.sys.mips Subject: Re: mips cc "shortcoming" with compile time array initializtion. Message-ID: <1771@tkou02.enet.dec.com> Date: 6 Jun 90 01:20:36 GMT References: <21901@boulder.Colorado.EDU> Reply-To: diamond@tkou02.enet.dec.com (diamond@tkovoa) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 30 In article <21901@boulder.Colorado.EDU> hartzell@beagle (George Hartzell) writes: > ccom: Error: moose.c, line 8: constant expected > static int ia[] = { ((char *) &X.a - (char *) &X), ((char *) > X.b - (cha > r *) &X), ((char *) &X.c - (char *) &X) } ; > --------------------------------------------------^ >I have two questions: > a) should this be legal [in the ansi sense?, in the practical > sense?] (The compiler should have all the info it needs to > figure this out, shouldn't it?) > b) do the 2.10 compilers support this construction? Well, here are your two answers: a) no, it's subjective, and yes. b) I don't know. but who's counting? It is not legal in ANSI. Whether it should be accepted practically is a matter of opinion. I personally think that it should be accepted with an optional warning. I think that the compiler has enough information to figure it out. Other compilers certainly prove that it is possible. I have seen rumors that MIPS, and perhaps DEC, are aware that competitors can handle this case. But if I were privileged enough to know their plans, I would not be allowed to tell you. -- Norman Diamond, Nihon DEC diamond@tkou02.enet.dec.com Proposed group comp.networks.load-reduction: send your "yes" vote to /dev/null.