-
Notifications
You must be signed in to change notification settings - Fork 159
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
struct scope problem #368
Comments
Another solution that would require less refactoring:
Keeping all types in global space will also make things like removing duplicate code easier and making the output code more simple. |
Also good example #346 |
@elliotchance , For myself is not clear about a reason for duplicates. |
In the first example there are two |
Also, example: void rr()
{
{
struct tt{
char* t;
};
struct tt u;
u.t = "Uuups";
}
{
struct tt{
double t;
};
struct tt u;
u.t = 42.24;
}
} |
Let's look on next C example:
We have 2 structs with same names
tt
and different internal items.What we have after transpiling?
It is happen, because Struct is global variable of program:
c2go/program/program.go
Lines 55 to 58 in a7ac059
How to solve that?
Create a scope for structs. Preliminary steps (in my point of view):
c2go/transpiler/transpiler.go
Lines 31 to 33 in a7ac059
c2go/transpiler/transpiler.go
Lines 358 to 363 in a7ac059
add for this
c2go/transpiler/transpiler.go
Line 323 in a7ac059
P.S. : Like I understood, same problem with unions.
P.P.S: Implementation of that issue only after success of #344.
The text was updated successfully, but these errors were encountered: