Message: Re: delete 0 Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: delete 0 

Keywords: G4Allocator
Forum: Event and Track Management
Re: None delete 0
Date: 01 Apr, 2003
From: Gabriele Cosmo <Gabriele Cosmo>

Hi Vincenzo,

> deleting a null pointer is legal in C++.
> G4Track * t=0;
> delete t;
> is G4Allocator<Type>::FreeSingle protected for this occurence
> or should it be detected by the
> Type::delete(Type*)?

actually, it is not. In its original implementation, it is assumed
this check is done by the client (I guess for performance reasons...)
and it's indeed so in the G4 kernel.
However, I agree with you in the point you make and will propose
to correct this. Thanks.

Cheers, Gabriele

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Re: delete 0"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]