I'm wondering if it is allowed in C++ to use overflow on purpose.
In specific I want to increase a counter every cycle and when uint32_max is reached start from 0.
In my mind the easy way would be:
uint32_t counter = 0;
while(condition)
{
counter++;
...
}
or would you manually reset the counter?:
uint32_t counter = 0;
while(condition)
{
if(counter == uint32_max)
{
counter = 0;
}
else
{
counter++;
}
...
}