Qbasicnews.com

Full Version: DIM SHARED, COMMON SHARED
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
What is the difference between

DIM SHARED a.variable

and

COMMON SHARED a.variable
DIM SHARED allows u to share a variable between subroutines while COMMON SHARED allows u to share a variable between modules(that obviously means you share the variable between subroutines).

Also, the rules for delcaring a COMMON SHARED variables are a bit different from DIM SHARED ones. For a bit detailed info have a look at qb's help.
DIM also allocates memory, while COMMON does not.
Yeah, as i have said in my post, there are a lot of differences.

You should look up the help once in a while Wink Its pretty well documented.
Though I'd reccomend against using COMMON at all, if you can help it. It has given me much trouble memory wise over Total Destruction, until they were removed.

Unless you're using multiple modules, I don't think there's a reason to use COMMON SHARED.
yes, I've read the qb help. That's where I usually look first for this sort of thing. My problem is that I have been self-educated in my programming, so many of the finer details of coding and the way computers operate have eluded me. I find that the explanations in the qb help guide are better reminders than teachers. They tend to describe functions in a rather brief fashion.

I see that DIM SHARED and COMMON SHARED have the same effect, as far as I can tell, and I am wondering if there is some effective difference between the two, some reason to use one or the other.

Is it preferential that I allocate memory for universal variables? I've been using COMMON SHARED without trouble, but it sounds like others may have difficulties with my program if I do that.
Hey, we have something in common - I'm pretty much self-taught too, except for the odd tutorial or book.
I look at people's source code
i swindle like rockman
Pages: 1 2 3 4