Re: TMath::Sort :: warning if n < array size

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Sun, 21 Aug 2011 15:58:56 +0200


Hi Adrian,

Thanks for your suggestion. We can't determine the sizeof(index), all we have is a pointer (not an array), and that would just return you sizeof(void*).

A recommendation: you could have used valgrind to find this problem in your usage of Sort().

Cheers, Axel.

On 8/21/11 1:29 AM, Adrian Sevcenco wrote:
> Hi! I was wondering if would be useful (for me it would because i just
> had some headaches because of this) to have a warning in case that
> either (this arguments related to [1]):
> 1. n < sizeof(index)/sizeof(index[0])
> or
> 2. sizeof(index) < sizeof(a)
>
> and definitely an error (if it is needed..) for
> n > sizeof(a)
>
> Thanks,
> Adrian
>
> [1]. http://root.cern.ch/root/html/src/TMath.h.html#YYNCbB
Received on Sun Aug 21 2011 - 15:59:02 CEST

This archive was generated by hypermail 2.2.0 : Sun Aug 21 2011 - 17:50:01 CEST