Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68239 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8793 invoked from network); 20 Jul 2013 03:09:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2013 03:09:58 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.172 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 74.125.82.172 mail-we0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:34483] helo=mail-we0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/19-13120-18FF9E15 for ; Fri, 19 Jul 2013 23:09:54 -0400 Received: by mail-we0-f172.google.com with SMTP id q56so4523099wes.17 for ; Fri, 19 Jul 2013 20:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vu/sr59psWuk12/lXV2G/ihYmAJ9JLeMDCf0eDoIbDA=; b=ZC5uBGkBfXTzohZsy7A3my5boFiSPm9wUEh418AGHGflWNlpK98pZv2S9AuAiGjUpF yocX1+keebSD8pW327Qm/nSVmMdsWrC2yvO+dMGaQbJkIV5oHdto3+VO+SVrK1yRqzhe KnXa7NCMNKP41EcaC9AVRhh2/NNq44ySm9DlKwzTT9VPnXyE6Un6rjuSepAYtGJXlt4l lTN89mdD94bfhDHW1Sb8EHt24llAfpob9V22uw+fxEtsIq4qrZlPXMk3cspux5t5zjq9 CgZfb7PoLHgpWeqg+rpDte5nQ4hvd/4E7/V8ntuJLgGI5ZBh2BqeDE7U06XMEi87trfk d2iw== MIME-Version: 1.0 X-Received: by 10.180.77.231 with SMTP id v7mr13250647wiw.49.1374289791095; Fri, 19 Jul 2013 20:09:51 -0700 (PDT) Received: by 10.227.207.6 with HTTP; Fri, 19 Jul 2013 20:09:51 -0700 (PDT) In-Reply-To: References: Date: Fri, 19 Jul 2013 23:09:51 -0400 Message-ID: To: Yasuo Ohgaki Cc: Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary=f46d043c0856d1596004e1e8c60c Subject: Re: [PHP-DEV] Operator precedence is undefined? From: theanomaly.is@gmail.com (Sherif Ramadan) --f46d043c0856d1596004e1e8c60c Content-Type: text/plain; charset=ISO-8859-1 On Fri, Jul 19, 2013 at 10:36 PM, Yasuo Ohgaki wrote: > Hi Sheif, > > 2013/7/20 Sherif Ramadan > >> Then I would say that example is wrong, but people may find reason to >> disagree. I'm basing my contention purely off what I see in php-src and the >> documented behavior for those operators. To me I see no reason why this >> behavior would be considered undefined. The ternary operator definitely has >> some undefined behavior in terms of precedence since its interpreted as a >> statement and not like other operators in expressions. To me post/pre >> inc/dec are pretty well-defined. >> > > I wasn't going to document ambiguity, but ?: > operator's association difference between C and PHP. > It's a common pitfall for C programmers when they use nested ternary > operators. > Yea, I believe the documentation at php.net/ternary already advices against nesting ternary in PHP. Honestly, I don't know how you would even put ternary into the precedence table given that it reads more like a statement and less like an operator. Just look at the implementation in the parser and you will be left in wonderment. --f46d043c0856d1596004e1e8c60c--