Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: "=?utf-8?B?aGthZGV2ZWxvcGVy?=" Newsgroups: gnu.bash.bug Subject: Re: shouldn't it the comma operator has the lowerest precedence intheshell arithmetic expression? Date: Wed, 2 Oct 2019 22:50:13 +0800 Lines: 39 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Trace: usenet.stanford.edu 1570027821 5633 209.51.188.17 (2 Oct 2019 14:50:21 GMT) X-Complaints-To: action@cs.stanford.edu To: "=?utf-8?B?Q2hldCBSYW1leQ==?=", "=?utf-8?B?YnVnLWJhc2g=?=" Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:mime-version:content-transfer-encoding:date :message-id; bh=i4ecWEEZv/Dio7t19rS7ic0h2QGAua0PWS/3DioD/iM=; b=mqFda0d+mcy7whYk7iHF91h0xuw5Z6Yu30dYG1UnDwM5YrkRXgTxZzUX/pRpyqF1sS snQOasFUX41/fN3fh1nYzIgX0eaOhUBRZ3usXl9xcx+Unv/msfjcSPhjlccKc0te0y21 UC/jbv8FR7cACwucuCe0npTefJ0LlqRIaJ1eoqtwJeJUNJJudRPJK9szT40B4E5hSiJv ykZBzgNGWund1Di90PxwaSpPa98zCPOnQPqGCpTSGWFec1/MFz6by0ZuuTlnHU4AqYxH 5B9+wop58sOlpvTX4puoRp0KCYnIPI+weujHpLMH3inGjAe3cxxlYuqmm3xhrw8qVugl HQcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:mime-version :content-transfer-encoding:date:message-id; bh=i4ecWEEZv/Dio7t19rS7ic0h2QGAua0PWS/3DioD/iM=; b=Cuws3W0EijTaKPrTk57BrixNorGpwfQQ3itEXrK5hSX26xyVoGi6NAQDfzw+DM+dGk n7uBC3Bfy4droP29X4Jpx5pSHBDz1UvSq5fzoJOoLjrEVlEW3bnX+3bspvm2jqF4UGKN W91YUxOOP7Me5M620+UBjbV9/sjGH07sHleB8VTq9S8/sJPh0sB9+QqTUpho3P/AZk9g 2Q25LyGCA/I+r9KdpqSR+R80eKJIp3wXwugr7NW7U7e4UgySJPgovO2WWkmiBgv7h/3e 2QHs1pWdmcXqxCXl5mYeefRd2A5b9DQA9dWaIjIfi6cdcQ+mZ21fA1w2cvhNE63jKgGu evOA== X-Gm-Message-State: APjAAAU2Zi4QYOqwUiaj7id52Qfsshy6pdBB6Zd3w0GZ+g+sKw4x5PAf mmbajcU5LPcyfVIqoGw4o0k= X-Google-Smtp-Source: APXvYqwu0AV89KCb8iBFg3OnLj+ag/NDipKCrSzUq/+hM6BOmsHN4MJXgvlfqqR5iWYIvpDfuUQODQ== X-Received: by 2002:a63:1c48:: with SMTP id c8mr4098981pgm.342.1570027816150; Wed, 02 Oct 2019 07:50:16 -0700 (PDT) X-QQ-MIME: TCMime 1.0 by Tencent X-Mailer: QQMail 2.x X-QQ-Mailer: QQMail 2.x X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::535 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:15458 Yes. I understand what you are saying. I mean isn’t it a little inconsistent about the comment, the macro name(EXP_HIGHEST) and the macro value(expcomma)? Thanks for you reply! ------------------ Original ------------------ From: "Chet Ramey" ; <"Chet Ramey" ;> Date: Wed,Oct 2,2019 10:28 PM To: hkadeveloper Subject: Re: shouldn't it the comma operator has the lowerest precedence inthe shell arithmetic expression? On 10/1/19 8:35 PM, hk wrote: > Configuration Information : > Bash Version: 5.0 > Patch Level: 0 > Release Status: release > > Description: > the code snippet from expr.c starting from line 141: > >> /* This should be the function corresponding to the operator with the >> highest precedence. */ >> #define EXP_HIGHEST expcomma > > > Am I understanding it wrong or is it a typo? The bash arithmetic parser does things in reverse order, in a way. So the comma operator is the first thing you call, and it calls functions that implement the other operators in ascending priority order. You didn't misunderstand it. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/