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

[DF] Display of char* branches is broken

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.24/00
    • Fix Version/s: 6.24/00, 6.22/02
    • Component/s: RDataFrame
    • Labels:
      None
    • Environment:

      any

      Description

      The problem is that arrays of characters are treated as all other arrays. They should be special-cased.

      Reproducer:

      #include <ROOT/RDataFrame.hxx>
      #include <TTree.h>
      #include <TFile.h>
      #include <algorithm>
       
      int main() {
        {
          TFile f("f.root", "recreate");
          TTree t("t", "t");
          char str[4] = "asd";
          t.Branch("str", str, "str[4]/C");
          t.Fill();
          char otherstr[4] = "bar";
          std::copy(otherstr, otherstr + 4, str);
          t.Fill();
          f.Write();
        }
        ROOT::RDataFrame("t", "f.root").Display()->Print();
        return 0;
      }
      

      prints

      str    |                                                                                                                                                                      
      'a'    |                                                                                                                                                                      
      ...    |                                                                                                                                                                      
      '0x00' |                                                                                                                                                                      
      'b'    |                                                                                                                                                                      
      ...    |                                                                                                                                                                      
      '0x00' |
      

        Attachments

          Activity

            People

            • Assignee:
              eguiraud Enrico Guiraud
              Reporter:
              eguiraud Enrico Guiraud
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: