Open hd-COO7 opened 1 year ago
Also --var;
as a statement by itself compiles but doesn't seem to actually decrement the variable.
Also
--var;
as a statement by itself compiles but doesn't seem to actually decrement the variable.
Oh that must be because it evaluates to the negation of the negation of. Should be super easy to implement prefix decrement since there's already an implementation of ++var. PR welcome.
If you do add a PR, make sure to add one or more tests as well. There are tests in codegen.rs and under ncc/tests/expressions.c
.
Prefix increment/decrement operator seems to be working fine but postfix increment/decrement operator throws error. Code to reproduce
int i =0; while(i < 5) { i++; }
This behaviour is not limited to any type. Was able to reproduce this for pointers was well in similar fashion
At the moment we have pre-increment but not post-increment because it's slightly trickier to implement. PR welcome.
Also
--var;
as a statement by itself compiles but doesn't seem to actually decrement the variable.
Just added prefix decrement, --var
works now.
Prefix increment/decrement operator seems to be working fine but postfix increment/decrement operator throws error. Code to reproduce
This behaviour is not limited to any type. Was able to reproduce this for pointers was well in similar fashion