c++ - Can a function return the same value inside a loop, and return different values outside of loops? -
it acts this.
fun();//return 1; (int i=0;i++;i<100) fun();//return 2; fun();//return 3;
i don't want manually, like:
static int i=0; fun(){return i}; main() { i++; fun();//return 1; i++; (int i=0;i++;i<100) fun();//return 2; i++; fun();//return 3; }
new classes , static variables allowed.
i trying design cache replacement algorithm. of time use lru algorithm, but, if use lru algorithm inside loop cache thrashing.
https://en.wikipedia.org/wiki/thrashing_(computer_science)
i need know if inside loop. can use lfu algorithm avoid thrashing.
an obvious way of doing using __line__
macro. return source code line number, different throughout function.
Comments
Post a Comment