Before c++17 the behavior was undefined, after that, It's fine according to [expr.ass]/1:
[...] the assignment is sequenced after the value computation of the right and left operands, and before the value computation of the assignment expression. The right operand is sequenced before the left operand
and sequenced before means according to [intro.execution]/8
[...] An expression X is said to be sequenced before an expression Y if every value computation and every side effect associated with the expression X is sequenced before every value computation and every side effect associated with the expression Y.
In conclusion, k=k-1
and k=k--
are guaranteed to yield the same result.
also see: cppreference