Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site sdchema.sdchema.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!hplabs!sdcrdcf!sdcsvax!sdcc3!sdchema!tps From: tps@sdchema.UUCP (Tom Stockfisch) Newsgroups: net.lang.c,net.bugs.4bsd Subject: Re: bug in cc (???) Message-ID: <442@sdchema.sdchema.UUCP> Date: Wed, 4-Sep-85 17:34:37 EDT Article-I.D.: sdchema.442 Posted: Wed Sep 4 17:34:37 1985 Date-Received: Sun, 8-Sep-85 16:20:54 EDT References: <502@lasspvax.UUCP> Reply-To: tps@sdchema.UUCP (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 67 Xref: watmath net.lang.c:6282 net.bugs.4bsd:1744 [] [Repost-- previous submission got mangled] Todd Olson writes that the 4.2 C compiler can't handle int n; struct S { int a; int b; } *X[2][2], . . . f( *X[n][0] ); /* cc complains on this line */ I think there are _many_ bugs in the way 4.2 handles passing whole structures. Consider the following bug bite I received which prevents me from treating complex numbers as primitives. The gyst is that you can't immediately access a member of a structure returned by a function. Very frustrating. /* C stuff trying to deal with complex numbers as primitives */ typedef struct { double re; double im; } complex; main() { complex topolar(); double mag; complex c2; static complex c1 = { 1.0, 2.0 }; /*###18 [cc] structure reference must be addressable%%%*/ mag = topolar(c1).re; /* sure would be nice if I * could do this */ /*###21 [cc] structure reference must be addressable%%%*/ mag = ( c2 = topolar(c1) ).re; /* even this doesn't work */ /* you have to break it into two separate statements--this works */ c2 = topolar(c1); mag = c2.re; } complex topolar( z ) /* convert z to polar form */ complex z; { complex polar; double hypot(), atan2(); /* details not related to bug */ polar.re = hypot( z.re, z.im ); polar.im = atan2( z.im, z.re ); return polar; } /* end of program */ I sure hope 4.3 fixes this. --Tom Stockfisch UCSD Chemistry