Qbasicnews.com
February 27, 2020, 07:22:02 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3
  Print  
Author Topic: DIM SHARED, COMMON SHARED  (Read 6415 times)
elspork
New Member

Posts: 19



« Reply #15 on: January 28, 2004, 01:44:20 AM »

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.
Logged

astrator of Crocodiles
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #16 on: January 28, 2004, 04:16:07 AM »

Quote from: "oracle"
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.
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #17 on: January 28, 2004, 04:21:01 AM »

Quote from: "elspork"
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:
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #18 on: January 28, 2004, 04:42:13 AM »

Quote from: "SCM"
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. :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Neo
Na_th_an
*****
Posts: 2150



« Reply #19 on: January 28, 2004, 05:30:17 AM »

Quote from: "TheBigBasicQ"
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
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #20 on: January 28, 2004, 06:29:42 AM »

Bleh, I never use such large arrays. When you occupy such a big amount of space in the conventional memory(16 * 3000 * 2 = 93.75KB) you leave little space for other variables. If thats a map of some sort I suggest you use EMS/XMS to store it.
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #21 on: January 28, 2004, 09:01:01 AM »

That's why I recoded it to have it occupy minimum space Wink
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #22 on: January 28, 2004, 11:48:52 AM »

Did u use EMS/XMS or just the 'primitive' conventional memory?
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #23 on: January 28, 2004, 06:10:06 PM »

Well, it's now only about 16 * 500 Wink

No, it's not in EMS. The 500 is the maximum.

And we now have loads of memory free Wink
Logged

Neo
Na_th_an
*****
Posts: 2150



« Reply #24 on: January 29, 2004, 10:56:50 AM »

16 * 500 was minimum for now, and all our sprites are put in Virtual XMS. And we have 300000 bytes of array mem free or so... Wink
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #25 on: January 29, 2004, 02:25:28 PM »

Ahem... if you are storing an integer then you occupy 16 * 500 * 2 = 16000 bytes =P
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #26 on: January 29, 2004, 08:52:55 PM »

Yeah, 16000 of 300000, it's not too much Wink
Logged

Agamemnus
x/ \z
*****
Posts: 3491



« Reply #27 on: January 29, 2004, 09:26:33 PM »

rel:

you can use the 20 function set.. You don't need to look at the internals... do you?

Looking at internal code is disgusting.....
Logged

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.
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #28 on: January 30, 2004, 03:22:54 AM »

Ahhhh...... Its for a tutorial?

 Cheesy
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #29 on: January 30, 2004, 04:39:04 AM »

You would require a supercomputer to decrypt aga's code =P
Logged
Pages: 1 [2] 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!