Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!Ozona!chase From: chase@Ozona.orc.olivetti.com (David Chase) Newsgroups: comp.lang.c Subject: Re: Declaration puzzler (C as intermediate code) Message-ID: <30599@oliveb.olivetti.com> Date: 13 Oct 88 01:28:01 GMT References: <30091@oliveb.olivetti.com> <717@wsccs.UUCP> Sender: news@oliveb.olivetti.com Reply-To: chase@Ozona.UUCP (David Chase) Organization: Olivetti Research Center, Menlo Park, CA Lines: 30 In article <717@wsccs.UUCP> dharvey@wsccs.UUCP (David Harvey) writes: >In article <30091@oliveb.olivetti.com>, chase@orc.olivetti.com (David Chase) writes: >> typedef foo *(foo[10]); >minds want to know. Seriously, what do you intend to use this type of >structure for? An array of arrays that point to themselves? Hmm, >methinks I smell some mischief. Well, you could call it mischief. In the interests of having a compiler for Modula-3 that is easy to port, we're generating C. The justification is that since it is possible to declare such an type in Modula-3, and we are compiling Modula-3, then we must generate some declaration for it (much as I am tempted, it is not considered good form for a compiler to offer snide comments on legal programs). I was cheerfully spitting out declarations for all sorts of things, but had a problem involving arrays. The problem eventually reduced itself to the example which I presented. I got pretty PO'd, and posted (I know, Ms. Net-manners says not do to that; allow me an occasional slip). As a workaround, we are wrapping all arrays up inside structures. This also gets us proper semantics for array assignment and parameter passing, so it isn't too much of a disaster. However, doing this makes me distinctly uneasy about the correctness/portability of addressing arithmetic performed for (multi-dimensional) open arrays. Ugh. By the way, anyone out there that thinks that C is a great intermediate language should think again. I was going to flame at length, but decided not to. David