I'm experimenting with this filters library, and getting an unsequenced modification warning from the following snippet.
while (--numSamples >= 0)
*dest++ = state.process(*dest, *this);
This makes sense looking at similar questions on SO, as dest is being modified and accessed in the same command. So, I guess the intended functionality is the following . . .
while (--numSamples >= 0) {
*dest = state.process(*dest, *this);
*dest++;
}
However, this gives a new, more curious warning "warning: expression result unused" for the post increment. Why this new warning, and how should I fix this correctly?
*dest++
increments dest
, and dereferences the prior value of dest
. The increment is a side effect that you want, the dereference has no effect. Just write it as dest++
(or ++dest
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.