Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Declaring a variable in a for loop #5

Closed
lain-dono opened this issue Feb 10, 2015 · 1 comment
Closed

Declaring a variable in a for loop #5

lain-dono opened this issue Feb 10, 2015 · 1 comment

Comments

@lain-dono
Copy link

This code produces a syntax error:

for (int i = 0; i<42; i++) {
    /* ... */
}

Such replacement works, but it's definitely uncomfortable to do manually:

int i;
for (i = 0; i<42; i++) {
    /* ... */
}
@rsc
Copy link
Owner

rsc commented Feb 10, 2015

This program is meant to handle the code found in the Go compiler (a C program). It is not a general C program. There's no intent to handle narrowly scoped variables well, for example.

@rsc rsc closed this as completed Feb 10, 2015
andybalholm pushed a commit to andybalholm/c2go that referenced this issue Nov 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants