Enrico Forestieri wrote:
On Sun, Dec 09, 2007 at 06:59:36PM +0100, Uwe Stöhr wrote:

What's the problem?
This code part is from Jürgen as proposal, because Angus and Abdel requested a solution without the declaration of the extern global variable as I did in the first version of the patch. When you have a cleaer solution, please post it. Better to learn now then to make the same mistake the next times.

p.s. When you are a real C++ master, then please act like this! Look for 
example at
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg133041.html
to see how this is done gentlemen like.

Uwe, the problem is that you happily bash others with harsh manners,
so you should not be surprised when you are paid with the same money.
Please, don't give me lessons about gentlemanliness when there are
posts in the archives demonstrating what a gentleman you are.

That said, I am not a C++ master and don't feel to give lessons to
anyone. Anyway, the following code appears amusing even to me:

+// the document's main language
+string document_language;
+
+string getDocumentLanguage()
+{
+       return document_language;
+}
+
+
+void setDocumentLanguage(string const & lang)
+{
+       document_language = lang;
+}
+

See, you still have a global variable but nonetheless you introduce
two accessor functions to set and get its value, when it can still
be freely referenced from everywhere.

At least it's only visible for the linker. To also suppress this,
Uwe, you could make it a file only variable:

static string document_language; // C-style

or C++ style:

namespace {
        string document_language;
}

or both:

namespace {
        static string document_language;
}


Wasn't there a thread recently, which is best?



So, please forgive me for having been in such a mood that didn't let me
refrain from returning some harshness.



--
Peter Kümmel

Reply via email to