thanks for the contribution to you all
int UC_LoopbackCounter::mfo_GetCurrentCount()
{
if (mvo_iCurrentCount >= mvo_iMaxCount)
{
mvo_iCurrentCount = 0;
}
return mvo_iCurrentCount++;
}
must admit i like this code best cause its easier to follow and debug should optimiser have other ideas. Partly why my original code is so spread out to debug the issue i was having.
But its official and totally new to me, that VS code optimiser is well known for breaking code.