Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15458

Re: shouldn't it the comma operator has the lowerest precedence intheshell arithmetic expression?

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From "hkadeveloper"<hkadeveloper@gmail.com>
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 <mailman.767.1570027821.2651.bug-bash@gnu.org> (permalink)
References <tencent_D677133F9DB7D6B3D6115ADB@qq.com>
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 "Chet Ramey"<chet.ramey@case.edu>, "bug-bash"<bug-bash@gnu.org>
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 <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <tencent_D677133F9DB7D6B3D6115ADB@qq.com>
Xref csiph.com gnu.bash.bug:15458

Show key headers only | View raw


   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@case.edu>; <"Chet Ramey"
   <chet.ramey@case.edu>;>
   Date: Wed,Oct 2,2019 10:28 PM
   To: hkadeveloper <hkadeveloper@gmail.com>
   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/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: shouldn't it the comma operator has the lowerest precedence intheshell arithmetic expression? "hkadeveloper"<hkadeveloper@gmail.com> - 2019-10-02 22:50 +0800

csiph-web