Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68250 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26026 invoked from network); 20 Jul 2013 04:29:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2013 04:29:11 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-la0-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:59799] helo=mail-la0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/9C-13120-4121AE15 for ; Sat, 20 Jul 2013 00:29:10 -0400 Received: by mail-la0-f42.google.com with SMTP id eh20so1622640lab.1 for ; Fri, 19 Jul 2013 21:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=mqpFeCkcXYOy40ISz5OA4wO+8bThuDuCIrCI4T4XkKc=; b=qeRYPubYS50SFeEJRY52IYXebp5hoACppWDaNJU0oOAAZW4vehtRmRMs1t7g0YY7Cu wn0QuvagjELnEKLS2WQifRKVaaKNx18IQHYmaXv12i3SxARBXgEFDA8sZUqiYbBoqU/f as4ERtpU/JVQrcKsow+YpdQJMzyu09KPnqddiLk1hWQlcVIyBaA2JgA3NHCIIp61zHur xPESNXhMtyI6TC+7f7tXw9fzqrgPjevnq79UfeILZzJG/cy7pxoJBW9ULuzqFHV+F9Kc E++lH7tGhTs1BU9spBw25vEhOju6B1857KYFJd+3mZTg6Td58VrVBI84dPaNNCxDaiBZ 9Meg== X-Received: by 10.112.219.102 with SMTP id pn6mr8557952lbc.18.1374294546015; Fri, 19 Jul 2013 21:29:06 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.4.233 with HTTP; Fri, 19 Jul 2013 21:28:25 -0700 (PDT) In-Reply-To: References: Date: Sat, 20 Jul 2013 13:28:25 +0900 X-Google-Sender-Auth: JsftTCCHLHx4Cz-YCMkiB0frMBc Message-ID: To: Sara Golemon Cc: Sherif Ramadan , PHP internals Content-Type: multipart/alternative; boundary=001a11c3ca143b6e1304e1e9e2a0 Subject: Re: [PHP-DEV] Operator precedence is undefined? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c3ca143b6e1304e1e9e2a0 Content-Type: text/plain; charset=UTF-8 Hi Sara, 2013/7/20 Sara Golemon > On Fri, Jul 19, 2013 at 7:16 PM, Yasuo Ohgaki wrote: > >> >> >> If there aren't comments, I'll rewrite the example. >> >> >> There were comments. I explicitly told you that that the behavior is > defined as undefined. You CHOSE to ignore that comment. You CHOSE to > break the documentation. > If there is defined precedence, arithmetic operation should follow it. If there is exception, it should be documented. I don't understand why/how the arithmetic operation can be ambiguous with defined precedence. (++ and -- are higher than +) $a = 1; echo ++$a + $a++; should always print 4 with current PHP precedence definition. If it does not, it's a bug in language. // mixing ++ and + produces undefined behavior $a = 1; echo ++$a + $a++; // may print 4 or 5 I don't see any reason it became undefined. If this kind of simple precedence is broken, how programmers write code and/or trust the language? http://3v4l.org/mR4da/vld#tabs This site seems support PHP 4.3.0 to PHP 5.5.0 and opcode looks fine. Am I missing something? If you would like to suggest use of (), it should be done differently. IMHO. The comment only ruins PHP's reputation as language. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c3ca143b6e1304e1e9e2a0--