Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-8442

Cling fails to correct initialise a variable to zero when it is not correctly declared

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.10/00
    • Component/s: Cling
    • Labels:
      None
    • Environment:

      All

      Description

      As showered in the simple example above, Cling does not set the variable n, which has not been declared to the correct value.

      void test() {
       
         for (int i = 0; i < 100; ++i) {
           // int n = 0; // to get correct result
            n = 0;
            for (int j = 0; j < 10; ++j)
               n++;
       
            std::cout << n << "   ";
         }
      }

      Lorenzo

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            moneta Lorenzo Moneta
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: