rstudio/rstudio — comment on commit e87fe766cfb2f27c9849da9dcb67e63c5a526624
File: src/cpp/core/tex/TexLogParser.cpp line 292
By jjallaire:

You might think this is way too paranoid, but I once ran into trouble with statics that had constructor arguments (this was on Ubuntu). Here was the comment I made (this is over in the ServerGoogleDocs.cpp):

// initialize server (create on the heap so it survives after this call)
// note that we attempted to make this static via anonymous namespace
// but on ubuntu server this resulted in the acceptor initialization failing
// (presumably because the presence of a constructor argument on an
// automatically initialized static gave the compiler problems?)

As a result when I need to have a bunch of static regex's I use the pattern that you can see in RTokenizer.cpp. I realize that this is verging on voodoo paranoia but (a) I spent a lot of time hunting down the cause of that first bug; and (b) this is C++ after all ;-)