Code:
int preinc(int num) {
return ++num;
}
int postinc(int num) {
return num++;
}
int postincp(int num) {
return (num++);
}
int addinc(int num) {
return num + 1;
}
int test = 0;
print("preinc "+preinc(test));
print("postinc "+postinc(test));
print("postincp "+postincp(test));
print("addinc "+addinc(test));
yields
> call scripts\Plus.ash
preinc 1
postinc 0
postincp 0
addinc 1
I would have expected ones for all cases.
The Operators page implies the prefix and postfix should both be performed before assignments and returning a value from a function seems to me similar in precedence.
Is this an ash bug or am I just projecting too much experience with other languages on ash?
Thanks.