Revision history for KeyPgTypeof
Revision [26769]
Last edited on 2024-02-25 04:15:18 by fxm [Before fbc 1.10.0, 'Typeof' was not returning the type of the non-static member procedures]Additions:
- Before fbc 1.10.0, ##**Typeof**## was not returning the type of the non-static member procedures of a UDT.
Additions:
##**Typeof**## was not returning the type of the data fields of a UDT.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Typeof**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Typeof**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Deletions:
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Typeof**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Revision [25498]
Edited on 2021-10-12 04:31:09 by fxm [differences from versions previous to 1.08 transferred to the Version section]Additions:
##**Typeof**## was not returning the type of the data fields of a UDT.
Deletions:
Revision [25494]
Edited on 2021-10-12 03:27:38 by fxm [differences from versions previous to 1.08 transferred to the Version section]Additions:
##**Typeof**## also supports passing any intrinsic data type, or user-defined type (and its data fields), not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar|Var]]##).
Example 1:
{{fbdoc item="filename" value="examples/manual/misc/typeof1.bas"}}%%(freebasic)
%%
Example 2:
{{fbdoc item="filename" value="examples/manual/misc/typeof2.bas"}}%%(freebasic)
%%
{{fbdoc item="ver"}}
- Before fbc 1.08.0:
##**Typeof**## was not returning the size of the data fields of a UDT.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Typeof**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Example 1:
{{fbdoc item="filename" value="examples/manual/misc/typeof1.bas"}}%%(freebasic)
%%
Example 2:
{{fbdoc item="filename" value="examples/manual/misc/typeof2.bas"}}%%(freebasic)
%%
{{fbdoc item="ver"}}
- Before fbc 1.08.0:
##**Typeof**## was not returning the size of the data fields of a UDT.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Typeof**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Deletions:
For fbc version < 1.08: When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Example 1:
{{fbdoc item="filename" value="examples/manual/misc/typeof1.bas"}}%%(freebasic)
%%
Example 2:
{{fbdoc item="filename" value="examples/manual/misc/typeof2.bas"}}%%(freebasic)
%%
Additions:
##**Typeof**## also supports passing any intrinsic data type, or user-defined type (and its data fields for fbc version >= 1.08), not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar|Var]]##).
For fbc version < 1.08: When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
For fbc version < 1.08: When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Deletions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
Deletions:
Revision [22698]
Edited on 2019-06-10 08:18:49 by fxm [Syntax for accessing a member field of a type/union is similar to the one for a variable in a namespace]Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression (same for a member field in a type/union accessed with the instance's name prefix). For example ##Typeof((namespace_name.variable))##.
Deletions:
Revision [22696]
Edited on 2019-06-10 07:59:35 by fxm [Syntax for accessing a member field of a type/union is similar to the one for a variable in a namespace]Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression (same for a member field in a type/union). For example ##Typeof((namespace_name.variable))##.
Deletions:
Revision [22331]
Edited on 2018-06-08 14:32:27 by fxm [Added explanation on using the syntax TYPEOF((namespace_name.variable))]Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((namespace_name.variable))##.
No Differences
Additions:
A [[DataType|DataType]].
##**Typeof**## also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar|Var]]##).
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Typeof""**##.
- ##[[KeyPgSizeof|Sizeof]]##
- ##[[KeyPgVar|Var]]##
- ##[[KeyPgTypeAlias|Type (Alias)]]##
- ##[[KeyPgType|Type...End Type]]##
##**Typeof**## also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar|Var]]##).
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Typeof""**##.
- ##[[KeyPgSizeof|Sizeof]]##
- ##[[KeyPgVar|Var]]##
- ##[[KeyPgTypeAlias|Type (Alias)]]##
- ##[[KeyPgType|Type...End Type]]##
Deletions:
##**Typeof**## also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar Var]]##).
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Typeof""**##.
- ##[[KeyPgSizeof Sizeof]]##
- ##[[KeyPgVar Var]]##
- ##[[KeyPgTypeAlias Type (Alias)]]##
- ##[[KeyPgType Type...End Type]]##
Revision [17658]
Edited on 2015-05-29 13:31:43 by FxMwikki [As already done for LEN/SIZEOF, added explanation on usage of TYPEOF((variable))]Additions:
##**Typeof**## also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar Var]]##).
If there is both a user defined type and a variable visible with the same name in the current scope, the user defined type takes precedence over the variable. To ensure that the ##**Typeof**## takes the variable instead of the user defined type, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((variable))##.
If there is both a user defined type and a variable visible with the same name in the current scope, the user defined type takes precedence over the variable. To ensure that the ##**Typeof**## takes the variable instead of the user defined type, wrap the argument to ##**Typeof**## with parentheses to force it to be seen as an expression. For example ##Typeof((variable))##.
Deletions:
Additions:
#if TypeOf(foo) = TypeOf(Integer)
#if TypeOf(foo) = TypeOf(String)
#print "It's a String!"
#if TypeOf(foo) = TypeOf(String)
#print "It's a String!"
Deletions:
Additions:
##**Typeof**## is a compiler intrinsic that replaces itself with the type of the variable passed to it. It can either be used in a variable declaration (Example 1) or it can be used in the preprocessor for comparison, printing. (Example 2)
##**Typeof**## also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar Var]]##)
Print SizeOf(teh_double)
#endif
- ##[[KeyPgSizeof Sizeof]]##
- ##[[KeyPgVar Var]]##
- ##[[KeyPgTypeAlias Type (Alias)]]##
##**Typeof**## also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like ##[[KeyPgVar Var]]##)
Print SizeOf(teh_double)
#endif
- ##[[KeyPgSizeof Sizeof]]##
- ##[[KeyPgVar Var]]##
- ##[[KeyPgTypeAlias Type (Alias)]]##
Deletions:
Typeof also supports passing any intrinsic data type, or user-defined type, not only variables defined as those types. Also supported are expressions, the type is inferred from the expression (much like [[KeyPgVar Var]])
Print Len(teh_double)
#endIf
Additions:
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Typeof""**##.
Deletions:
Additions:
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias __Typeof.
Deletions:
Revision [14454]
Edited on 2009-08-29 21:57:21 by CountingPine [Remove CamelCase links in "New to FreeBASIC"]Additions:
- New to ""FreeBASIC""