-
-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For loops #45
Comments
Hello pesiman, that's one finding I feared. Your are totally right that this is a valid expansion of a for-loop. I can remember a couple of times I explained this to students. I'm just unsure whether it is a good idea to transform all for-loops to while-loops. I always had options for that in mind. That you can choose for your needs which parts should be transformed. |
I was thinking that there's a sequence of transforms, and the user chooses where to stop. |
Conceptual idea: |
Hello @simonrenger, extra mode like a command line option: -use-while-loops? Andreas |
@andreasfertig yes in that way and on the website than just a drop down menu or checkbox(s). I am sure there are other things than just while loops |
Hello @simonrenger, @pepsiman, ok that is what I have in mind. I will push a patch to introduce this functionality in C++ Insights. There will be options to C++ Insights Andreas |
Fixed #45: Support showing for-loops as their while-loop representation.
https://en.cppreference.com/w/cpp/language/for says that for loops are equivalent to while loops.
"The above syntax produces code equivalent to:
{
init_statement
while ( condition ) {
statement
iteration_expression ;
}
}"
The text was updated successfully, but these errors were encountered: