quote:Original post by DrPizza
It very much *IS* close to the same as a global.
In particular:
It can be modified by multiple threads simultaneously
It can be modified by multiple functions simultaneously
Nothing outside that module can touch that variable. Nothing else can
see it. Sure you could create multiple threads in that same file to mess with it, but that is
your business. Nothing outside this module can do this.
quote:Original post by DrPizza
What the hell are you talking about?
Let's just see.
Java: Every class derives from Object, and Object has a method called... toString(). And that method's purpose is, let's see... oh my god, it's to convert that object to a string.
I'll grant you that much of the time it's called implicitly, which hides its existance, but it's very much there (so, if you want, write yourself a C++ class hierachy that implements a similar mechanism).
It's part of a class so you can call ToString on any object to get the string equivalent. The same thing can be accomplished in C++ by overloading a ToString function.
My point is this: I can write a set of functions using sprintf to achieve the exact same thing as stringstream, minus the state information. Hell, most iostream classes
use sprintf to convert the types! These set of functions will also produce slightly faster code and take up less memory.
So once again,
if speed and memory constraints are a major concern, and you don't plan on keeping state information, then you would you use the class over the functions ?
That is my point, a point you seem to be missing entirely.
quote:Original post by DrPizza
C# has no library or class hierarchy at all. If you mean the classes of the CLR/CLI, then, oh me oh my. We have the Object class and its ToString() method.
Sigh, yes, I meant the CLR and you knew exactly what I was talking about. Yet, you still try to insist on pointing out grammatical errors and misused terms instead of focusing on the debate.
Since you like doing this so much:
quote:Original post by DrPizza
It very much *IS* close to the same as a global.
The definition of global in the American Heritage dictionary:
global 3.
Comp. Sci. Of an entire program or document.
By definition something that only spans one file is
not global. It's not even
close .
Of course, I
knew what you had really meant, which is that you believe the consequences of using a file scope instance is similar to that of a global instance. But since we are nit picking...
- Houdini
Edited by - Houdini on February 6, 2002 10:09:12 PM