Path: utzoo!attcan!uunet!husc6!rutgers!psuvax1!schwartz@shire.cs.psu.edu From: schwartz@shire.cs.psu.edu (Scott Schwartz) Newsgroups: comp.lang.c Subject: Pcc bites it (was Re: programming puzzle (silly)) Message-ID: <4357@psuvax1.cs.psu.edu> Date: 12 Mar 89 05:15:03 GMT References: <28336@ucbvax.BERKELEY.EDU> <2821@goofy.megatest.UUCP> <24820@amdcad.AMD.COM> Sender: news@psuvax1.cs.psu.edu Reply-To: schwartz@shire.cs.psu.edu (Scott Schwartz) Organization: Pennsylvania State University, Computer Science Lines: 15 In-reply-to: tim@crackle.amd.com (Tim Olson) In article <24820@amdcad.AMD.COM>, tim@crackle (Tim Olson) writes: >| > main(m,n){scanf("%d",&n);for(m=n>0^n>9;n&&m*=n--;); >| > printf(m?"Answer=%d\n":"error\n",m);} >Interesting -- the program *is* incorrect, because && has higher >precedence than *= so it is parsed as: Unfortunately, pcc accepts lots of things that aren't C. No need to be surprised this time! Another fun example is "struct {int foo};". >What do other compilers out there do? Gcc 1.34 says "invalid lvalue in assignment". -- Scott Schwartz