Message: Documentation omission for G4Trajectory Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Documentation omission for G4Trajectory 

Forum: Documentation and Examples
Date: 01 Aug, 2005
From: Tom Roberts <Tom Roberts>

In section 5.1.6 the User's Guide discusses a customized version of G4Trajectory. It does not mention that if your derived class declares any class variables then you MUST provide operator new and operator delete. This is required because G4Trajectory provides those operators based on G4Allocator<G4Trajectory>, which is specific to sizeof(G4Trajectory). If you aren't aware of this subtle point, you'll get segmentation faults in your constructor that are VERY difficult to debug.

Subtleties like this should also be mentioned in comments in the code. Another useful thing to do is to check that the allocation size in operator new is equal to sizeof(G4Trajectory) (e.g. via an assert). This applies to every class using G4Allocator.

Note this does not apply to G4VTrajectory, as it has no operators new or delete.

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

1 None: Re: Documentation omission for G4Trajectory   (Dennis H. Wright - 02 Aug, 2005)
 Add Message Add Message
to: "Documentation omission for G4Trajectory"

 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 ]