Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: net.lang Subject: Re: Re: Multiple assignments Message-ID: <2846@utcsri.UUCP> Date: Mon, 26-May-86 16:08:51 EDT Article-I.D.: utcsri.2846 Posted: Mon May 26 16:08:51 1986 Date-Received: Mon, 26-May-86 16:24:52 EDT References: <1455@mmintl.UUCP> <825@bentley.UUCP> <1482@mmintl.UUCP> <201@cdx39.UUCP> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 32 Summary: In article <201@cdx39.UUCP> jc@cdx39.UUCP (John Chambers) writes: >Surely there is no problem making a compiler understand >such syntax. As for why you might want it in C, haven't >you ever been bitten by the "feature" of incompatible >types in a set-several-things-to-zero command? Try the >following: > main() { > char *x; > double y; > y = x = 0; > } >and see what your C compiler does. Silly, isn't it? > It becomes the same as x = 0; y = x; /* actually y=(double)x */ Are you suggesting that given (x,y)=0; it will be easier for a compiler to detect the incompatibility and generate x = 0; y = 0.0; ???? I don't really think so. Note that the written-out 'explicit' version of your initialization is as above; y = 0 causes an implicit ( compile-time ) conversion. So writing x=y=0; is asking for trouble, anyway. Actually, this is the case with most compilers regardless of the types of x and y, although it shouldn't be. Changing the syntax of multiple assignments has little bearing on the problem itself, which is one of code generation. -- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg