CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Bugs

Fixed staticinitorder bugs in getEnv and dotFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 7, 2009, 10:03
Default ulongIO.C has the same issue a
  #21
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 7
mwild is on a distinguished road
ulongIO.C has the same issue as uintIO.C. Here I would take a static_cast<unsigned>, because conversion operators are only defined for one-word types.

Michael
mwild is offline   Reply With Quote

Old   January 8, 2009, 06:50
Default Henry I think the init-orde
  #22
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 7
mwild is on a distinguished road
Henry

I think the init-order problem is much worse:

Almost every class contains in it's implementation file a call to either defineTypeNameAndDebug which calls ::Foam::debug::debugSwitch, or it calls that function directly. Other candidates are ::Foam::debug::{info,optimisation}Switch. All of them call (indirectly) ::Foam::debug::switchSet, which in turn calls ::Foam::debug::controlDict, resulting in ::Foam::dotFoam being called, resulting in the same problem as discussed in above posts.

I think you agree that moving all these static initializers into global.Cver is not an option, especially as it would make it impossible to add a new library later on, as that would require a change to global.Cver.

I see these options:
  1. Make the XXX::null members use "initialization on first use"
  2. Change dotFoam such that it doesn't ever receive al XXX::null instance (by e.g. first checking whether a environment variable exists using Foam::env before calling Foam::getEnv)
  3. Don't return XXX:null in any of the functions called by dotFoam

IMHO, none of the options is very appealing...

Michael
mwild is offline   Reply With Quote

Old   January 8, 2009, 16:28
Default The ulong issue is now fixed i
  #23
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 12
henry is on a distinguished road
The ulong issue is now fixed in 1.5.x, thanks for the suggestion.

I will think about the debug switch initialization and get back to you.

H
henry is offline   Reply With Quote

Old   January 9, 2009, 05:21
Default I don't suppose it would be an
  #24
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 7
mwild is on a distinguished road
I don't suppose it would be an option to get rid of all the static variables and replace them with "init on first use"? Probably would introduce quite some overhead, can't be inlined and Info() << "Hello\n" is just dead ugly
mwild is offline   Reply With Quote

Old   January 9, 2009, 05:24
Default It's an option but not a good
  #25
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 12
henry is on a distinguished road
It's an option but not a good option. I need time to think about it and play with some alternatives.

H
henry is offline   Reply With Quote

Old   January 9, 2009, 11:16
Default Is your original proposed chan
  #26
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 12
henry is on a distinguished road
Is your original proposed change to ::Foam::dotFoam sufficient to resolve the global construction order problems you are seeing? If so at this point I think it is the best of the options.

H
henry is offline   Reply With Quote

Old   January 9, 2009, 11:33
Default It solved it for me in the cur
  #27
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 7
mwild is on a distinguished road
It solved it for me in the current configuration. But similar issues might crop up anytime (e.g. compiler version changes etc.) However, I do agree that currently this is the easiest way out. Still I would like to see a more permanent solution to the whole issue...

Michael
mwild is offline   Reply With Quote

Old   January 9, 2009, 11:37
Default If there are currently no othe
  #28
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 12
henry is on a distinguished road
If there are currently no other global construction order dependencies your solution should be general unless we add further globally constructed entities which depend on the current ones -- we should avoid this.

H
henry is offline   Reply With Quote

Old   January 10, 2009, 09:29
Default Thanks for every thing
  #29
New Member
 
Mansuor Alghane
Join Date: Mar 2009
Location: Edinburgh, UK
Posts: 2
Rep Power: 0
ma404 is on a distinguished road
Thanks for every thing
ma404 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugs in fvcsurfaceIntegrate su_junwei OpenFOAM Bugs 4 July 7, 2013 11:29
Bugs in FFT luca OpenFOAM Bugs 2 January 27, 2009 16:40
15x readme txt file of fixed bugs podallaire OpenFOAM Bugs 5 October 2, 2008 09:50
Wiki - Bugs Andy R Main CFD Forum 0 July 25, 2008 14:15
bugs in starcd 4.06 whitemelon CD-adapco 0 July 11, 2008 07:26


All times are GMT -4. The time now is 05:33.