Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DIM SHARED, COMMON SHARED
#11
I'd use DIM SHARED where possible. COMMON SHARED (AFAIK) will use more memory if many modules are used than DIM SHARED. And COMMON SHARED arrays... I think you have to DIM the array then COMMON SHARED it, which is just silly Wink
Reply
#12
I don't just use people's source code, I steal it and then change it so that no one knows I stole it.

Big Grin
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#13
It's true. After Aga is done with it no one would recognise it.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#14
Im self taught too, but I also use snitbits of others codes, sometimes modified, sometimes not... For example, the challenge I won at http://forum.qbasicnews.com/viewtopic.php?t=4963 was won buy taking someone elses 3d code and adding some other elements to it to make it red/blue, ect.
url=http://webberboy.no-ip.com]Fine Hand-Crafted Pens[/url]
Pneumonoultramicroscopicsilicovolcanoconiosis: Noun, A hypothetical, invented disease of the lungs, caused by inhaling mineral or metallic dust, such as silicon and quartzite, over a long period.]
Reply
#15
Great. Thanks.

I suppose it would be better still to avoid the universal variables whenever possible. I'm still working on that. I make liberal use of subroutines, and sometimes it gets complicated for simple me to selectively import variables that get used frequently.

confession: I have actually been using exclusively universal variables. I haven't had any memory problems yet (that I know of), but perhaps my programs would speed up like when I converted to DEFINT A-Z.

Well, actually I HAVE had memory problems. I've been assuming they were due to problems running QB in Microsquish.
astrator of Crocodiles
Reply
#16
Regarding self-teaching:

I think that is part of the draw to QBasic. There is such an element of discovery for someone like me, who is only a hobbyist programmer. I'm actually a sculptor and designer, but programming is the best creative problem solving medium I've found. Learning Qbasic in particular at this point is more a matter of community sharing than education. It is a lot more exciting to dismantle somebody else's code to learn than to read a book.

I started in Qbasic about twelve years ago with my best friend. It was just the two of us in his basement, with the qb help file. We were thrilled when we figured out the PALETTE function. We could manipulate colors! it was two years before we figured out it did more than black to bright red, but we were thrilled nonetheless. Now, I get on the internet, and there are thousands of programs much better than my own to dismantle and figure out.
astrator of Crocodiles
Reply
#17
Quote:I'd use DIM SHARED where possible. COMMON SHARED (AFAIK) will use more memory if many modules are used than DIM SHARED. And COMMON SHARED arrays... I think you have to DIM the array then COMMON SHARED it, which is just silly Wink

Oracle, are you *sure* you know COMMON SHARED and used it properly?

Because when using arrays you need to do something like this:

Module 1:
COMMON SHARED my_arr()
DIM SHARED my_arr(10) AS INTEGER

my_arr(1) = 14
blah blah blah...

Module 2:
COMMON SHARED my_arr1()


DIM SHARED my_arr1(10) AS INTEGER

print my_arr1(1)
blah blah blah...

Output:
14

The order of declaration matters and not the name of the variable. Also, you need to COMMON SHARED it before you DIM it Wink.

I dunno what memory problems you had but I am using COMMON SHARED in my GUI which has 5 modules and it works fine without any memory problem and it compiles from within the QB-IDE.
Reply
#18
Quote:Regarding self-teaching:

I think that is part of the draw to QBasic. There is such an element of discovery for someone like me, who is only a hobbyist programmer. I'm actually a sculptor and designer, but programming is the best creative problem solving medium I've found. Learning Qbasic in particular at this point is more a matter of community sharing than education. It is a lot more exciting to dismantle somebody else's code to learn than to read a book.

I started in Qbasic about twelve years ago with my best friend. It was just the two of us in his basement, with the qb help file. We were thrilled when we figured out the PALETTE function. We could manipulate colors! it was two years before we figured out it did more than black to bright red, but we were thrilled nonetheless. Now, I get on the internet, and there are thousands of programs much better than my own to dismantle and figure out.

Wow, the story of my friend and me is almost exactly same =P. I too used the QB help file until 4 years ago when I got my first internet connection. I still depend only on the help files. And occassionally I give these guys questions to ponder upon :lol:
Reply
#19
Quote:It's true. After Aga is done with it no one would recognise it.
LOL

Aga: If you make that iterative Qsort routine of yours readable, I might have some use for it. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#20
Quote:I dunno what memory problems you had but I am using COMMON SHARED in my GUI which has 5 modules and it works fine without any memory problem and it compiles from within the QB-IDE.
Did you try commoning DIM SHARED Level(16, 2000) AS INTEGER? We tried but we got out of memory each time. Making a remark of the COMMON SHARED line solved the prob, but I did more than that because I think declaring arrays in includes is a bad idea Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)