Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyword: Common
#1
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.
Reply
#2
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
Reply
#3
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*
Reply
#4
Does FB support COMMON SHARED /Name/ construct fully? I hope, so it allowed some nice tricks.
Reply
#5
doubt it supports the tricks Wink. Tricks are usually things that take long times to code :p.
Reply
#6
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)
Reply
#7
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...
Reply
#8
I dont' know. Then you'd have a 60-page novel on spaghetti-coding.
Reply
#9
What does that spaghetti coding exactly means?

Even in Quake there are global vars used and their number is quite high Smile.
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)