Opened 14 years ago

Last modified 13 years ago

#48 new defect

getenv and G4UIExecutive

Reported by: /C=FR/O=CNRS/OU=UMR8607/CN=Laurent Garnier/emailAddress=garnier@… Owned by:
Priority: minor Milestone: Geant4.9.5
Component: Interfaces Version:
Keywords: Cc:

Description

See mail thread : Rép : Question to G4UIExecutive

Hi John,

I honestly do not much like the idea of using calls to the
environment directly in the code... I know that this is done
already in some parts of the hadronic code, though...
Use of 'getenv' has caused headaches to our friends of the
multi-threading, for example...

In this case however, the benefit is rather obvious, and should
perhaps be investigated, also measuring possible run-time
performance costs...
I would exclude this change now for the coming release though!

Cheers, Gabriele

---------------
On Nov 24, 2009, at 6:03 PM, John Allison wrote:

Dear Gabriele,

One of our users (Andreas Schaelicke) has asked if we could change G4VisExecutive so that the selection is made at run time.  In other words, can we avoid recompilation on change of environment.

Is it feasible to replace

#ifdef G4VIS_USE_OPENGLX

by

if(getenv(G4VIS_USE_OPENGLX)) {...

etc., in G4VisExecutive.icc, and similarly G4UI_USE... in G4UIExecutive.icc?

John.

Begin forwarded message:

From: Laurent Garnier <garnier@lal.in2p3.fr>
Date: 24 November 2009 16:23:55 GMT
To: John Allison <john.allison@manchester.ac.uk>
Cc: Joseph Perl <perl@slac.stanford.edu>, Guy Barrand <barrand@lal.in2p3.fr>
Subject: Re: Question to G4UIExecutive


Le 24 nov. 2009 à 16:30, John Allison a écrit :

Andreas's point is very pertinent: with the introduction of G4UIExecutive, it is not so obvious that one needs to recompile to get another UI.  (The same has been the case for a very long time regarding G4VisExecutive.  All the same, changing UI is probably a more common situation.)
"getenv".  It's an idea.  Is it worth persuing?

Is "getenv" working on all systems ?
Laurent

Begin forwarded message:
From: Andreas Schaelicke <andreas.schaelicke@desy.de>Date: 24 November 2009 12:55:11 GMTTo: Laurent Garnier <garnier@lal.in2p3.fr>Cc: john.allison@manchester.ac.ukSubject: Question to G4UIExecutive
Dear Laurent, Dear John,

I just realised another (for me) unexpected behaviour.

I started using G4UIExecutive and realised the same "features" as the previous "#ifdef" constructions.
In particular I have to recompile if I want to switch between different UI (G4UITcsh, G4Qt, ....).
I agree that it provides more clean user code, but is also even less flexible than the explicit "#ifdef" constructions in the user main.cc (where the user could reorder to change the preference).

This obviously not going to change for the 9.3 release. But is there a plan to use "getenv" in future versions?

Best regards,
Andreas

----

if (getenv("G4UI_USE_QT")) {
// ...
}



John Allison                   Tel: +44-1422-845624Dept. of Physics & Astronomy   Mobile/Cell: +44-7810-242262The Univ. of Manchester        Email: John.Allison@manchester.ac.ukMANCHESTER M13 9PL             Email(2): John.Allison@3-C.CoopUK                             WWW: http://www.hep.man.ac.uk/u/johna




John Allison                   Tel: +44-1422-845624
Dept. of Physics & Astronomy   Mobile/Cell: +44-7810-242262
The Univ. of Manchester        Email: John.Allison@manchester.ac.uk
MANCHESTER M13 9PL             Email(2): John.Allison@3-C.Coop
UK                             WWW: http://www.hep.man.ac.uk/u/johna




-- 

*---------------------------------------------------------------------*
Gabriele Cosmo                         mailto:Gabriele.Cosmo@cern.ch
Phone: +41 22 76-79636                 Fax: +41 22 76-78130
Mail : CERN PH/SFT, CH-1211 Geneva 23, Switzerland
Web  : http://cern.ch/Gabriele.Cosmo
*---------------------------------------------------------------------*

Change History (1)

comment:1 Changed 13 years ago by /C=FR/O=CNRS/OU=UMR8607/CN=Laurent Garnier/emailAddress=garnier@…

Milestone: Geant4.9.4Geant4.9.5
Note: See TracTickets for help on using tickets.