On Thu, Jun 10, 2010 at 05:50:26PM -0500, Chucky Ellison wrote:
> Granted, in the second and forth case the two variables do not share
> any visibility, but having the names conflict means we have to handle
> scoping in our own tools.  Unique names effectively means we don't
> need to handle scope at all, and it doesn't seem difficult from the
> point of view of CIL to provide this.

No idea what CIL is supposed to do (although the current behavior seems
fine to me), but anyway you have two *much* better ways to discriminate
your variables: use OCaml's physical equality (==) or (even safer if you
do not have a clear idea of CIL's internals) the vid field of varinfo:

type varinfo = {
    (* ... *)
    mutable vid : int;  (*  A unique integer identifier. This field will
                    be set for you if you use one of the Cil.makeFormalVar,
                    Cil.makeLocalVar, Cil.makeTempVar, Cil.makeGlobalVar, or
                    Cil.copyVarinfo.    *)
    (* ... *)
}

Alpha-conversion (Cil.uniqueVarNames) is useful, when you *create* new
variables, not to bother of name clashing in the current scope;
makeTempVar can serve the same purpose but does not handle globals.

Regards,
-- 
Gabriel Kerneis

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to