Qbasicnews.com
Keyword: Common - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+---- Forum: FB Documentation (http://qbasicnews.com/newforum/forum-17.html)
+---- Thread: Keyword: Common (/thread-7384.html)

Pages: 1 2


Keyword: Common - rdc - 05-25-2005

The statement section in the Keyword list is done, except for the Common keyword, which is missing an example. I can't quite figure this one out, so if someone could work up a little example, that would be great.


Keyword: Common - keeling - 05-26-2005

A lot of FB's keywords are like QB. Use the QB Online Help at the top of this screen (look under index) to get an idea.

What I have gathered, (and please correct me if I am wrong), is that COMMON allowed global variables (consider bad practice). It could even be used between exe's.

Here is a quick example. Not exactly what I'd put in the documnets, but it should give you an idea about the command.

Code:
Option Explicit
Common shared A as double

sub TestIt
    A = 6
end sub

A = 5
? A
TestIt
? A
sleep



Keyword: Common - Jofers - 05-26-2005

I should update that quickhelp so it works in Mozilla browsers. The only way to really do that is use unicode, which means I'd have to rewrite the scripts that generated the shtml. Especially considering I lost them in a hard drive crash.

*sigh*


Keyword: Common - etko - 05-26-2005

Does FB support COMMON SHARED /Name/ construct fully? I hope, so it allowed some nice tricks.


Keyword: Common - Nexinarus - 05-26-2005

doubt it supports the tricks Wink. Tricks are usually things that take long times to code :p.


Keyword: Common - v3cz0r - 05-26-2005

It isn't supported, as shown in the differences.. Common is much easier than in QB, as the variables order doesn't matter, only the names. What "trick"? Sharing data between different executables? That's called bad practice ;). (But yeah, variables can be shared between DLL's and client exe's using EXTERN)


Keyword: Common - etko - 05-26-2005

It was good to sharing data between modules. One module used all three global sets from library another only one. That module with shared only set was isolated from other "shares".

Code:
LIB CODE:

  COMMON SHARED /GlobalVars1/ Bla Bla
  COMMON SHARED /GlobalVars2/ Bla Bla
  COMMON SHARED /GlobalVars3/ Bla Bla

MODULE 1:

  COMMON SHARED /GlobalVars2/
  COMMON SHARED /GlobalVars3/

MODULE 2:

  COMMON SHARED /GlobalVars1/

This is bad practice? Maybe there should be section in wiki about bad practices written by experienced programmers...


Keyword: Common - Jofers - 05-26-2005

I dont' know. Then you'd have a 60-page novel on spaghetti-coding.


Keyword: Common - etko - 05-28-2005

What does that spaghetti coding exactly means?

Even in Quake there are global vars used and their number is quite high Smile.


Keyword: Common - Jofers - 05-28-2005

spaghetti-coding is code that's heavily obsfucated because it's been hacked over time and again.

e.g. a lot of gotos, few subs, few comments, unmeaningful variables large in number and thrown all over the place and alot of code that's been commented out for experimentation.

Usually, a lot of personal projects are considered spaghetti-code.