3 ms·
> The `let ++` example is pretty damning. Seems kind of logical, the following c code behaves the same way. #include <stdio.h> int test(void) {
by trashtester 4y ago
> The `let ++` example is pretty damning.
Seems kind of logical, the following c code behaves the same way.
#include <stdio.h>
int test(void) {
int i=0;
return i++;
}
void main(void) {
printf("i = %d\n", test());
}
'let i++' evaluates to / returns 0 before increasing i, just like c would.
- stevebmark 4y agoI don't mean what it returns, I mean that returning non-zero trips up Bash into thinking it's a non-successful error code. The fact that doing math can trip up error detection implies a fundamental design flaw of the system. Which, I mean, we're in Bash, of course it's poorly designed. I didn't know it was quite this bad though.