Scope of variables in macros

Hi all,
I ran across an annoying little surprise trying to process a macro. If you have the file Test.C:

#include <iostream>
void Test()
{

  if(true){
    int var = 1;
  }
  cout<<var<<endl;
}

then run it with the usual “.x Test.C”, it prints 1; however var should have gone out of scope on exiting the if block. Is this behavior intentional? I’m running version 5.13, and unfortunately don’t have the access privileges to update.

Cheers,
Ben

Hi,

no, not intentional. It’s a known deficiency of CINT which we plan to address this year in the version of CINT using Reflex.

Cheers, Axel.