Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68267 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60812 invoked from network); 20 Jul 2013 09:35:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2013 09:35:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.53 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.53 mail-la0-f53.google.com Received: from [209.85.215.53] ([209.85.215.53:38951] helo=mail-la0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/33-13120-8E95AE15 for ; Sat, 20 Jul 2013 05:35:37 -0400 Received: by mail-la0-f53.google.com with SMTP id fj20so2244777lab.40 for ; Sat, 20 Jul 2013 02:35:33 -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=vSu5oDE8y/DAMKUViRRXnl4nbUfpEDQsm1yWv6LiQTE=; b=f7pPQRXw7FEVp4/Wi/IvPYwdHwTKPwMi0XlkFrzy3CQOMikQ72gQIzB4h/nCjUPp3v AvacBH5gtXl2HUQ3xWW/AEXH68p8J14SQSwT40xW86O6CiEvHisqeFqrRdYz4aBv2CLC 0SXJPybYVVXXtGrcDF0POd7QD17ZSL8MgcJi/cnVXyla1FNywePG4xg4RCx0AHAeTSjm wEUcUrM+Pkec9uHY7WCctVcWG6E6RbW9lO+6/TZpEkINnK3Jx6OLbOMtRflz8XIbQ5Xn kP9ies1qu8OnVDMRGYGzhIywv4ZuAx0hyNwulifjjCkwDIeBaoD4Kob+TuCi6pMowLPB bfQA== X-Received: by 10.112.34.209 with SMTP id b17mr8871094lbj.55.1374312933484; Sat, 20 Jul 2013 02:35:33 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.4.233 with HTTP; Sat, 20 Jul 2013 02:34:53 -0700 (PDT) In-Reply-To: References: <51EA4006.7060008@sugarcrm.com> Date: Sat, 20 Jul 2013 18:34:53 +0900 X-Google-Sender-Auth: UHpgjbZXIfOO9PLRqMDwOFzKc8Q Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=14dae93d8ede35ef8a04e1ee2a00 Subject: Re: [PHP-DEV] Operator precedence is undefined? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --14dae93d8ede35ef8a04e1ee2a00 Content-Type: text/plain; charset=UTF-8 Hi all, Explanation for undefined behaviors. ======================= // If a side effect on a variable is unsequenced relative to another // side effect on the same variable, the behavior is undefined. $i = 1; $i = ++$i + $i++; // undefined behavior $i = $i++ + 1; // undefined behavior (but $i = ++$i + 1; is well-defined) f(++$i, ++$i); // undefined behavior f($i = -1, $i = -1); // undefined behavior // If a side effect on a varible is unsequenced relative to a value // computation using the value of the same variable, the behavior // is undefined. $a[$i] = $i++; // undefined behavior ======================= If there are more of these, please point it out. The cause of confusion is the fact that these are not about precedence. It would better to have dedicated section for undefined behaviors, IHMO. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --14dae93d8ede35ef8a04e1ee2a00--