GNOME Bugzilla – Bug 469335
Variables in generated code might conflict with user code
Last modified: 2009-04-14 18:24:41 UTC
Please describe the problem: Vala generates code with char* __temp0 and so on. This might conflict with __temp0 from user code. Nothing life threatening. Still this might cause a sleepless night for an unexperienced user. Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information:
Yes, we should ensure that generated variable names never conflict in the C code. We should also avoid the __ prefix as that's reserved for the C compiler implementation.
What about replacing the "__" prefix with "__valac_"? Vala is a compiler, so it might be ok to inject stuff in the compiler namespace. Well, and I doubt any C compiler ever will introduce some "__valac_" prefixed variables expect for sabotaging valac. Regarding the conflict: I guess valac should just reject symbols with a double underscore. As you pointed out: The "__" namespace is reserved for compilers...
(In reply to comment #2) > What about replacing the "__" prefix with "__valac_"? Vala is a compiler, so it > might be ok to inject stuff in the compiler namespace. Well, and I doubt any C > compiler ever will introduce some "__valac_" prefixed variables expect for > sabotaging valac. > > Regarding the conflict: I guess valac should just reject symbols with a double > underscore. As you pointed out: The "__" namespace is reserved for compilers... > A combination of those two solution would be perfect imo.
*** Bug 477326 has been marked as a duplicate of this bug. ***
*** Bug 508450 has been marked as a duplicate of this bug. ***
*** Bug 530698 has been marked as a duplicate of this bug. ***
*** Bug 537032 has been marked as a duplicate of this bug. ***
commit 74cb5c7d6d1df95f7779f84b58f31ceeab5417ad Author: Jürg Billeter <j@bitron.ch> Date: Fri Apr 10 10:27:11 2009 +0200 Improve handling of reserved identifiers Avoid conflicts between reserved identifiers and generated code for local variables and formal parameters. Fixes bug 469335 and bug 515225.
*** Bug 572992 has been marked as a duplicate of this bug. ***