[C2hs] patch applied (c2hs): Deal with the scope of the ' for' loop' s decl properly

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Apr 15 06:34:31 EDT 2007


Sun Apr 15 00:13:42 PDT 2007  Duncan Coutts <duncan.coutts at worc.ox.ac.uk>
  * Deal with the scope of the 'for' loop's decl properly
  typedef int n;                    // n declared as a type name
  for (int n = ...; ...; ...) stmt; // n now considered a normal ident
  n n = 0;                          // n reverts to being a type name
  the declaration can define a local var (eg 'n') that masks a type of the same
  name from an outer scope. The local var goes out of scope at the end of the
  for loop's statement, if we don't do this then we treat 'n' as a normal ident
  rather than a typeident after the 'for' statement.

    M ./c2hs/c/CParser.y -2 +2


More information about the C2hs mailing list