Repository navigation
Add foreach emulation for older compilers - #1138
Conversation
|
wait.. I don't want to have a FOREACH macro. we will move to real c++11 sooner or later. It's too soon today, but in a few years it should be ok. |
|
Sure, I just figure its something we could use now, and when we move to C++11 its easy to do |
|
I dont like this FOREACH macro. so I close this PR. I would like that we carefully move to the real range for loops. I don't have a good picture about what compilers people use to compile cppcheck. that is something we want to have before we start using the real range for loops everywhere. I don't know how we can get a good picture. I discussed in the chat about writing a compiler warning if an old gcc version is used. In short it would tell the user to please report the version to cppcheck project. maybe a forum would be nice so we can ask the users if there is a workaround or if they are going to upgrade. |
Why?
And this allows us to use real range for loops without it breaking on older compilers. I dont really see the problem. |
|
sorry.. I have changed my mind. this emulation is acceptable. range for loops is the c++11 feature I miss the most right now. |
This provides a fallback for older compilers that don't support the for-range loop. I wasn't able to test this with gcc 4.4 as it doesn't build with cppcheck, but it should work as it does support both
autoand rvalue references.