Re: TIter it(NULL); it();

Fons Rademakers ((no email))
Tue, 24 Feb 1998 23:43:17 +0100 (MET)


Hi Alexander,

I've added the checks. Thanks for the suggestion.

Cheers, Fons.

>
> Dear all!
>
> The string
> TIter it(NULL); it();
> produces:
> *** Break *** Segmentation violation
>
> May be it will be good to do some internal checks in TIterator?
> I think it is better to have
>
> void better(TList *l)
> {
> TIter it(l);
> while( TObject *o=it() )
> .....
> }
>
> than
>
> void worse(TList *l)
> {
> if( NULL!=l )
> {
> TIter it(l);
> while( TObject *o=it() )
> .....
> }
> }
>
> better(NULL);
> worse (NULL);
>
> Alexander Zvyagin.
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910