[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Arithmetic expression: evaluation order bug
From: |
Steffen Nurpmeso |
Subject: |
Arithmetic expression: evaluation order bug |
Date: |
Thu, 29 Dec 2022 18:23:09 +0100 |
User-agent: |
s-nail v14.9.24-383-g2889cb06b9 |
Hello.
Name: bash
Path: /usr/ports/core
Version: 5.2.15
Release: 1
$ i=10 j=20;echo $(( i += j += i += j ));echo $i,$j
60
60,50
$ i=10 j=20;echo $(( i += j += i += i ));echo $i,$j
50
50,40
$ cat t.c
#include <stdio.h>
int main(void){
int i, j;
i = 10, j = 20;
i += j += i += j;
printf("%d,%d\n", i, j);
i = 10, j = 20;
i += j += i += i;
printf("%d,%d\n", i, j);
return 0;
}
$ tcc -run t.c
80,50
60,40
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
- Arithmetic expression: evaluation order bug,
Steffen Nurpmeso <=
- Re: Arithmetic expression: evaluation order bug, Alain D D Williams, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Emanuele Torre, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Alain D D Williams, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Alain D D Williams, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Andreas Schwab, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Andreas Schwab, 2022/12/29
- Re: Arithmetic expression: evaluation order bug, Steffen Nurpmeso, 2022/12/29