From owner-freebsd-hackers Fri Aug 10 15:47:51 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mx01-a.netapp.com (mx01-a.netapp.com [198.95.226.53]) by hub.freebsd.org (Postfix) with ESMTP id 3459A37B405 for ; Fri, 10 Aug 2001 15:47:48 -0700 (PDT) (envelope-from boshea@netapp.com) Received: from frejya.corp.netapp.com (frejya.corp.netapp.com [10.10.20.91]) by mx01-a.netapp.com (8.11.1/8.11.1/NTAP-1.2) with ESMTP id f7AMkWX13727; Fri, 10 Aug 2001 15:46:32 -0700 (PDT) Received: from eclipse-fe.eng.netapp.com (localhost [127.0.0.1]) by frejya.corp.netapp.com (8.11.1/8.11.1/NTAP-1.2) with ESMTP id f7AMkWw00911; Fri, 10 Aug 2001 15:46:32 -0700 (PDT) Received: (from boshea@localhost) by eclipse-fe.eng.netapp.com (8.8.8+Sun/8.8.8) id PAA19617; Fri, 10 Aug 2001 15:46:31 -0700 (PDT) Date: Fri, 10 Aug 2001 15:46:30 -0700 From: "brian o'shea" To: Raymond Wiker Cc: les@safety.net, Rob , "hackers@FreeBSD.ORG" Subject: Re: the =+ operator Message-ID: <20010810154630.A27553@netapp.com> References: <3B73F0BC.548D40B3@home.com> <200108101446.HAA99867@safety.net> <15220.9386.441669.962830@raw.grenland.fast.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/0.96.3i In-Reply-To: <15220.9386.441669.962830@raw.grenland.fast.no>; from Raymond Wiker on Fri, Aug 10, 2001 at 08:15:06PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Aug 10, 2001 at 08:15:06PM +0200, Raymond Wiker wrote: > > This is actually wrong - the += and -= operators were > originally written as =+ and =-. This is obviously ambiguous, given > the fact that whitespace is ignored. Why does this have to be ambiguous? Consider this: int o = 2; int *p = &o; int q = 8; int r; r = q/*p /* comment */; printf("r == %d\n", r); Is this equivalent to the following: r = q / *p; Or is it equivalent to this: r = q /* p /* comment */ ; C disambiguates between these two possible interpretations by matching the largest possible token. Thus, it is taken to be equivalent to: r = q; In other words, these two lines are not equivalent: r = q/*p /* comment */; r = q/ *p /* comment */; So, the =+ operator could be interprited correctly as long as it is the largest possible token. It does leave more of an opportunity for human misinterpritation, while my example is less likely to be seen. -brian -- Brian O'Shea "Stare not too deeply into the pen, 3.3.163(PEN) lest the pen stare back into you." (408) 822-3249 -------------------------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message