Revision history for KeyPgShared


Revision [22210]

Last edited on 2018-02-10 16:45:24 by JeffMarshall [VAR can also be shared]
Additions:
[[KeyPgVar|Var]] **Shared** ...


Revision [21288]

Edited on 2016-04-01 08:01:29 by fxm [Added link to BYREF (variables)]
Additions:
- ##[[KeyPgByrefVariables|Byref (variables)]]##


Revision [21136]

Edited on 2016-03-13 10:52:48 by fxm [Formatting]
Additions:


Revision [20522]

Edited on 2016-02-10 16:08:42 by DkLwikki [Update link format]
Additions:
[[KeyPgDim|Dim]] **Shared** ...
[[KeyPgRedim|Redim]] **Shared** ...
[[KeyPgCommon|Common]] **Shared** ...
[[KeyPgStatic|Static]] **Shared** ...
##**Shared**## makes module-level variables visible inside ##[[KeyPgSub|Sub]]##s and ##[[KeyPgFunction|Function]]##s.
NOTES (for ##**Shared**## variables excluding ##[[KeyPgCommon|Common]]## variables):
- ##[[KeyPgCommon|Common]]##
- ##[[KeyPgDim|Dim]]##
- ##[[KeyPgErase|Erase]]##
- ##[[KeyPgExtern|Extern]]##
- ##[[KeyPgLbound|Lbound]]##
- ##[[KeyPgRedim|Redim]]##
- ##[[KeyPgPreserve|Preserve]]##
- ##[[KeyPgStatic|Static]]##
- ##[[KeyPgUbound|Ubound]]##
- ##[[KeyPgVar|Var]]##
Deletions:
[[KeyPgDim Dim]] **Shared** ...
[[KeyPgRedim Redim]] **Shared** ...
[[KeyPgCommon Common]] **Shared** ...
[[KeyPgStatic Static]] **Shared** ...
##**Shared**## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s.
NOTES (for ##**Shared**## variables excluding ##[[KeyPgCommon Common]]## variables):
- ##[[KeyPgCommon Common]]##
- ##[[KeyPgDim Dim]]##
- ##[[KeyPgErase Erase]]##
- ##[[KeyPgExtern Extern]]##
- ##[[KeyPgLbound Lbound]]##
- ##[[KeyPgRedim Redim]]##
- ##[[KeyPgPreserve Preserve]]##
- ##[[KeyPgStatic Static]]##
- ##[[KeyPgUbound Ubound]]##
- ##[[KeyPgVar Var]]##


Revision [17438]

Edited on 2015-01-30 03:32:34 by FxMwikki [Reformat]
Additions:
NOTES (for ##**Shared**## variables excluding ##[[KeyPgCommon Common]]## variables):
- Generally a ##**Shared**## variable may only be initialized with a constant value (its starting value is set at the start of the program in the .data section before any code is run, and so it cannot depend on any variables or functions in it).
- A first exception is a ##**Shared**## variable of var-len string type, that never can be initialized, even with a constant string (because of its structure with a descriptor in the .data section, but to point to a dynamic memory block).
- A second exception is a ##**Shared**## variable of user-defined type having a constructor even implicit, that can be initialized with a non-constant value (because it's the constructor code, called when the program starts, which writes the "initial" values into the .data section).
Deletions:
NOTES (for shared variables excluding ##[[KeyPgCommon Common]]## variables):
- Generally a shared variable may only be initialized with a constant value (its starting value is set at the start of the program in the .data section before any code is run, and so it cannot depend on any variables or functions in it).
- A first exception is a shared variable of var-len string type, that never can be initialized, even with a constant string (because of its structure with a descriptor in the .data section, but to point to a dynamic memory block).
- A second exception is a shared variable of user-defined type having a constructor even implicit, that can be initialized with a non-constant value (because it's the constructor code, called when the program starts, which writes the "initial" values into the .data section).


Revision [17437]

Edited on 2015-01-30 03:26:21 by FxMwikki [Common variable cannot be initialized]
Additions:
NOTES (for shared variables excluding ##[[KeyPgCommon Common]]## variables):
Deletions:
NOTES:


Revision [17436]

Edited on 2015-01-29 17:31:12 by FxMwikki [Added exception for shared variable initializing]
Additions:
NOTES:
- Generally a shared variable may only be initialized with a constant value (its starting value is set at the start of the program in the .data section before any code is run, and so it cannot depend on any variables or functions in it).
- A first exception is a shared variable of var-len string type, that never can be initialized, even with a constant string (because of its structure with a descriptor in the .data section, but to point to a dynamic memory block).
- A second exception is a shared variable of user-defined type having a constructor even implicit, that can be initialized with a non-constant value (because it's the constructor code, called when the program starts, which writes the "initial" values into the .data section).
Deletions:
Note: A shared variable may only be initialized with a constant value: its starting value is set at the start of the program before any code is run, and so it cannot depend on any variables or functions in it. The exception is a shared variable of var-len string type, which never can be initialized, even with a constant string, because of its structure with a descriptor pointing to dynamic memory block.


Revision [16204]

Edited on 2012-06-13 15:26:56 by FxMwikki [shared variable of var-len string type never can be initialized, even with a constant string]
Additions:
Note: A shared variable may only be initialized with a constant value: its starting value is set at the start of the program before any code is run, and so it cannot depend on any variables or functions in it. The exception is a shared variable of var-len string type, which never can be initialized, even with a constant string, because of its structure with a descriptor pointing to dynamic memory block.
Deletions:
Note: A shared variable may only be initialised with a constant value: its starting value is set at the start of the program before any code is run, and so it cannot depend on any variables or functions in it.


Revision [16158]

Edited on 2012-04-14 07:33:53 by FxMwikki [only variable declared with Dim without Shared and not inside a Namespace block is stored on stack]
Additions:
##**Shared**## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s.
If ##**Shared**## is not used on a module-level variable's declaration, the variable is only visible to the module-level code in that file (furthermore, only a variable declared with ##Dim## without ##Shared## modifier, and not inside a Namespace block, is stored on the stack).
Deletions:
##**Shared**## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s. If ##**Shared**## is not used on a module-level variable's declaration, the variable is only visible to the module-level code in that file (besides, a variable declared with ##Dim## only is stored on the stack).


Revision [15756]

Edited on 2012-01-22 08:58:31 by FxMwikki [Add 'Static Shared']
Additions:
##**Shared**## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s. If ##**Shared**## is not used on a module-level variable's declaration, the variable is only visible to the module-level code in that file (besides, a variable declared with ##Dim## only is stored on the stack).
- The ##**Shared**## statement inside scope blocks -- functions, subs, if/thens, and loops -- is not supported. Use ##Dim##|##Redim##|##Common##|##Static **Shared**## in the main program instead. Or if you're inside a scope block and ##Redim##ming a variable or array previously set up with ##**Shared**##, just do a ##Redim## without ##**Shared**##; it will work fine and won't ruin anything.
Deletions:
##Shared## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s. If ##Shared## is not used on a module-level variable's declaration, the variable is only visible to the module-level code in that file (besides, a variable declared with ##Dim## only is stored on the stack).
- The ##Shared## statement inside scope blocks -- functions, subs, if/thens, and loops -- is not supported. Use ##Dim##|##Redim##|##Common##|##Static Shared## in the main program instead. Or if you're inside a scope block and ##Redim##ming a variable or array previously set up with ##Shared##, just do a ##Redim## without ##Shared##; it will work fine and won't ruin anything.


Revision [15754]

Edited on 2012-01-22 08:12:46 by FxMwikki [Add 'Static Shared']
Additions:
[[KeyPgStatic Static]] **Shared** ...
##Shared## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s. If ##Shared## is not used on a module-level variable's declaration, the variable is only visible to the module-level code in that file (besides, a variable declared with ##Dim## only is stored on the stack).
- The ##Shared## statement inside scope blocks -- functions, subs, if/thens, and loops -- is not supported. Use ##Dim##|##Redim##|##Common##|##Static Shared## in the main program instead. Or if you're inside a scope block and ##Redim##ming a variable or array previously set up with ##Shared##, just do a ##Redim## without ##Shared##; it will work fine and won't ruin anything.
Deletions:
##Shared## makes module-level variables visible inside ##[[KeyPgSub Sub]]##s and ##[[KeyPgFunction Function]]##s. If ##Shared## is not used on a module-level variable's declaration, it is stored on the stack of the implicit main function and therefore only visible to the module-level code in that file.
- The ##Shared## statement inside scope blocks -- functions, subs, if/thens, and loops -- is not supported. Use ##Dim##|##Redim##|##Common Shared## in the main program instead. Or if you're inside a scope block and ##Redim##ming a variable or array previously set up with ##Shared##, just do a ##Redim## without ##Shared##; it will work fine and won't ruin anything.


Revision [15753]

Edited on 2012-01-22 07:42:36 by FxMwikki [Remove 'Shared' from the links list]
Deletions:
- ##[[KeyPgShared Shared]]##


Revision [13750]

Edited on 2008-09-29 18:01:59 by CountingPine [Shared variables can only be initilised with constants]
Additions:
Note: A shared variable may only be initialised with a constant value: its starting value is set at the start of the program before any code is run, and so it cannot depend on any variables or functions in it.


Revision [13548]

Edited on 2008-07-21 15:43:08 by JeffMarshall [added #lang or $lang to example]
Additions:
'$lang: "qb"
Declare Sub MySub
Dim Shared x As Integer
Dim y As Integer
Sub MySub
Print "x is "; x 'this will report 10 as it is shared
Print "y is "; y 'this will not report 5 because it is not shared
End Sub
Deletions:
declare sub MySub
dim shared x as integer
dim y as integer
sub MySub
print "x is "; x 'this will report 10 as it is shared
print "y is "; y 'this will not report 5 because it is not shared
end sub


Revision [12785]

The oldest known version of this page was created on 2008-04-01 15:45:28 by JeffMarshall [added #lang or $lang to example]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode