Problem with the inconsistencies in TMath

Dear ROOTers

Currently, I have a problem with the new definitions of TMath::Sort() which cause problems in CINT, see: … 25ffbc8fe8

In this regard I realized that TMath has now severe inconsistencies:
Please compare TMath.h from root_v5.18/00 and root_v5.20/00.

As an example, TMath.h in root_v5.18/00 defines:

Long64_t  LocMin(Long64_t n, const Short_t *a);
Long64_t BinarySearch(Long64_t n, const Short_t *array,   Short_t value);
Short_t   KOrdStat(Long64_t n, const Short_t *a,  Long64_t k, Long64_t *work=0);

void Sort(Int_t n,    const Short_t *a,  Int_t *index,    Bool_t down=kTRUE);
void Sort(Long64_t n, const Short_t *a,  Long64_t *index, Bool_t down=kTRUE);

while in root_v5.20/00 it is defined as (according to:

Long64_t	LocMin(Long64_t n, const short* a)
Long64_t	BinarySearch(Long64_t n, const short* array, short value)
short	KOrdStat(long long n, const short* a, long long k, long long* work = 0)

void	Sort(Long64_t n, const short* a, long long* index, Bool_t down = kTRUE)

I cannot even find the files where the different functions are defined. They are surely not defined in
TMathBase.h, as “” suggests.

While until now ROOT has always defined e.g. Int_t, Double_t, etc internally, which (as far a I know)
is considered to be good programming practice, this seem no longer to be the case in root_v5.20/00,
at least for TMath.h

Is there a certain reason for this inconsistency?
(I would prefer if ROOT would continue to define the types consistently.)

Best regards

Dear ROOTers

Meanwhile I have found that in root_v5.20/00 the mentioned functions are implemented in TMath.h as templates,
and that the different types are defined in file LinkDef.h.

It is a little confusing that the html help-file does not show the definitions of LinkDef.h but uses the usual types.

Best regards


sorry for the late reply! You have hit the three major deficiencies of THtml: namespaces (it cannot document multiple header files defining a namespace, so in your case it’s just TMathBase.h), templates (it doesn’t manage to document templates but only template instances), and template arguments (CINT expands them to the underlying type and THtml doesn’t notice). So that explains all you have noticed but it doesn’t help you :slight_smile:

I am still hoping to see a THtml using the refection data from Reflex, once ROOT’s dictionaries are based on that. It should get rid of the first two issues; the typedef vs. final type might then not be relevant anymore, once THtml only documents the template itself (not a set of template instances).

Cheers, Axel.

Dear Axel

Thank you for your reply: better late than never :slight_smile:

Luckily, for me this is a minor issue. It reminds me that sometimes it is better to look at the source code before posting.

Best regards