Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!ncar!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Is &a[NTHINGS] legal Message-ID: <11390@mimsy.UUCP> Date: 7 May 88 08:42:16 GMT References: <12074@tut.cis.ohio-state.edu> <1788@akgua.ATT.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 27 In article <1788@akgua.ATT.COM> brb@akgua.ATT.COM (Brian R. Bainter) writes: >Taking into consideration that a is an address and NTHINGS is an >offset to that address, there should be no problem whatsoever with >this construct. There are more hosts in heaven and earth, B.B., than are dreamt of in your philosophy. (Funny wording to make the syllables come out right. `B.B.' is only two syllables, but the accents fix that :-) .) >C ... does not make any limit checks for arrays. There is no such promise in the language. An implementation is free to check. It is true that most do not, as this tends to worsen benchmark numbers, and hence does little for sales. >If you have a question with something like this, it may be most >worthwhile to write a test program and try the construct or algorithm >out. While this remains good advice, remember that this provides only one existence proof for a single implementation. Hence you can say with utter certainty that at least one C compiler simply adds an offset to a base. As it turns out, others do something different. Fortunately &a[NTHINGS] is legal by definition (or fiat, as it were), according to the dpANS. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris