MISRA Discussion Forums
6.5 - variable kinds suitable for use as loop counter - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.6 Statements (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=135)
+---- Thread: 6.5 - variable kinds suitable for use as loop counter (/showthread.php?tid=1313)



6.5 - variable kinds suitable for use as loop counter - grunwald - 16-02-2017

Which of the following is a 'variable' and thus suitable for use as loop counter (and subject to the restrictions on loop-control-variables)?
  • local variable
  • static/global variable
  • class member variable
  • function parameter [code]void f(int x) { for (; x



Re: 6.5 - variable kinds suitable for use as loop counter - misra cpp - 10-07-2017

All your examples are acceptable as loop counters