Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!think!ames!ucbcad!ucbvax!decvax!decwrl!labrea!rocky!rokicki From: rokicki@rocky.UUCP Newsgroups: comp.sys.amiga Subject: Re: Caveat for Manx C (3.20 and 3.40) Message-ID: <210@rocky.STANFORD.EDU> Date: Sat, 21-Mar-87 22:09:06 EST Article-I.D.: rocky.210 Posted: Sat Mar 21 22:09:06 1987 Date-Received: Sun, 22-Mar-87 16:42:41 EST References: <477@oscvax.UUCP> Organization: Stanford University Computer Science Department Lines: 34 Summary: Another problem In article <477@oscvax.UUCP>, rico@oscvax.UUCP writes: > Watch out for this: > > char a[65537]; > int i; > > main() > { > for (i=0;i<65537;i++) a[i] = i; > } Also be careful of constructions like: char *a ; unsigned int i ; test() { a[i] ; } If i > 32767, you get the wrong value. Coercing it to a long: a[(long)i] ; doesn't work, either; the compiler throws away the coercion. The only way I've been able to get it to work is as follows: char *a ; unsigned int i ; long zero = 0 ; test() { a[i+zero] ; } -tom