Revision history for KeyPgTypeAlias


Revision [21718]

Last edited on 2016-11-27 05:12:55 by fxm [Rewording one sentence]
Additions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers (whatever their passing mode), or otherwise with parameters (excluding arrays) but passed or returned only by reference. Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.
Deletions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers (whatever passing mode), or otherwise with parameters (excluding arrays) but passed or returned by reference. Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.


Revision [21717]

Edited on 2016-11-27 05:03:18 by fxm [Rewording one sentence]
Additions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers (whatever passing mode), or otherwise with parameters (excluding arrays) but passed or returned by reference. Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.
Deletions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers, or otherwise with parameters (excluding arrays) but passed or returned by reference. Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.


Revision [21716]

Edited on 2016-11-27 03:52:40 by fxm [Rewording one sentence]
Additions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers, or otherwise with parameters (excluding arrays) but passed or returned by reference. Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.
Deletions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers or parameters passed by reference (excluding arrays). Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.


Revision [21701]

Edited on 2016-11-13 01:40:54 by fxm [Formatting]
Additions:
'Dim As Function (Byval As Integer) As Integer f ''this syntax works but is less readable than the next code line
'Dim As Function (Byval As Integer) As Integer Ptr pf ''this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf ''this syntax works
Print (*pf)(123) ''the dereferenced pointer to procedure pointer must be enclosed in parentheses
Deletions:
'Dim As Function (Byval As Integer) As Integer f 'this syntax works but is less readable than the next code line
'Dim As Function (Byval As Integer) As Integer Ptr pf 'this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf 'this syntax works
Print (*pf)(123) 'the dereferenced pointer to procedure pointer must be enclosed in parentheses


Revision [21694]

Edited on 2016-11-12 01:16:05 by fxm [Formatting]
Additions:
Function triple (ByVal i As Integer) As Integer
Type As Function (ByVal As Integer) As Integer function_alias
'Dim As Function (Byval As Integer) As Integer f 'this syntax works but is less readable than the next code line
'Dim As Function (Byval As Integer) As Integer Ptr pf 'this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf 'this syntax works
Print (*pf)(123) 'the dereferenced pointer to procedure pointer must be enclosed in parentheses
Deletions:
Function triple (Byval i As Integer) As Integer
Type As Function (Byval As Integer) As Integer function_alias
'Dim As Function (Byval As Integer) As Integer f '' this syntax works but is less readable than the next code line
'Dim As Function (Byval As Integer) As Integer Ptr pf '' this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf '' this syntax works
Print (*pf)(123) '' the dereferenced pointer to procedure pointer must be surrounded by parenthesis


Revision [21691]

Edited on 2016-11-09 16:46:09 by fxm [Added a type alias usage to declare a pointer to a function pointer]
Additions:
'Dim As Function (Byval As Integer) As Integer f '' this syntax works but is less readable than the next code line
Dim As function_alias f
f = @triple
'Dim As Function (Byval As Integer) As Integer Ptr pf '' this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf '' this syntax works
pf = @f
Print (*pf)(123) '' the dereferenced pointer to procedure pointer must be surrounded by parenthesis
Deletions:
'Dim As Function (Byval As Integer) As Integer f = @triple '' this syntax works but is less readable than the next line
Dim As function_alias f = @triple
'Dim As Function (Byval As Integer) As Integer Ptr pf = @f '' this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf = @f '' this syntax works
Print (*pf)(123) '' the dereferenced pointer to procedure pointer must be surrounded by parenthesis


Revision [21690]

Edited on 2016-11-09 15:47:15 by fxm [Added a type alias usage to declare a pointer to a function pointer]
Additions:
A type alias must be used to allow declaration of pointer to a function pointer, otherwise ptr applies on return type and not on function.
{{fbdoc item="filename" value="examples/manual/udt/type-fctptr.bas"}}%%(freebasic)
Function triple (Byval i As Integer) As Integer
Return 3 * i
End Function
Type As Function (Byval As Integer) As Integer function_alias
'Dim As Function (Byval As Integer) As Integer f = @triple '' this syntax works but is less readable than the next line
Dim As function_alias f = @triple
Print f(123)
'Dim As Function (Byval As Integer) As Integer Ptr pf = @f '' this syntax does not work because Ptr applies on Integer and not on function
Dim As function_alias Ptr pf = @f '' this syntax works
Print (*pf)(123) '' the dereferenced pointer to procedure pointer must be surrounded by parenthesis


Revision [20727]

Edited on 2016-02-29 02:44:01 by fxm [one sentence refined]
Additions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers or parameters passed by reference (excluding arrays). Generally the bodies of such procedures need to be implemented further in the code once the actual types are well defined.
Deletions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers or parameters passed by reference (excluding arrays). The procedure bodies need to be implemented further in the code once the actual types are well defined.


Revision [20726]

Edited on 2016-02-28 03:32:09 by fxm [location of procedure bodies vs forward types]
Additions:

A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers or parameters passed by reference (excluding arrays). The procedure bodies need to be implemented further in the code once the actual types are well defined.
Deletions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers or parameters passed by reference (excluding arrays).


Revision [20562]

Edited on 2016-02-10 16:09:48 by DkLwikki [Update link format]
Additions:
**Type** //typename// [[KeyPgAs|as]] //symbol//
##//symbol//## may refer to any declared data type including a built-in data type, ##[[KeyPgSub|Sub]]## or ##[[KeyPgFunction|Function]]## pointer, ##[[KeyPgType|Type]]## declaration, ##[[KeyPgUnion|Union]]## declaration, or ##[[KeyPgEnum|Enum]]## declaration.
A type alias can also be used to allow forward declarations of data fields in [[CatPgUserDefTypes|User Defined Types]], but only used with pointers.
- ##[[KeyPgType|Type...End Type]]##
- ##[[KeyPgTypeTemp|Type (Temporary)]]##
Deletions:
**Type** //typename// [[KeyPgAs as]] //symbol//
##//symbol//## may refer to any declared data type including a built-in data type, ##[[KeyPgSub Sub]]## or ##[[KeyPgFunction Function]]## pointer, ##[[KeyPgType Type]]## declaration, ##[[KeyPgUnion Union]]## declaration, or ##[[KeyPgEnum Enum]]## declaration.
A type alias can also be used to allow forward declarations of data fields in [[CatPgUserDefTypes User Defined Types]], but only used with pointers.
- ##[[KeyPgType Type...End Type]]##
- ##[[KeyPgTypeTemp Type (Temporary)]]##


Revision [17386]

Edited on 2014-12-08 16:57:22 by FxMwikki [Rewriting of ambiguous sentence]
Additions:
A type alias can be used to allow forward declarations of parameters in procedure declarations, but only used with pointers or parameters passed by reference (excluding arrays).


Revision [17385]

Edited on 2014-12-08 15:59:40 by FxMwikki [Rewriting of ambiguous sentence]
Additions:
A type alias can also be used to allow forward declarations of data fields in [[CatPgUserDefTypes User Defined Types]], but only used with pointers.
Deletions:
A type alias can be used to allow forward declarations of [[CatPgUserDefTypes User Defined Types]], but only used with pointers.


Revision [16073]

Edited on 2012-02-04 11:40:18 by FxMwikki [UDT forward declaration, using type alias, is available only for pointers]
Additions:
A type alias can be used to allow forward declarations of [[CatPgUserDefTypes User Defined Types]], but only used with pointers.
Deletions:
A type alias can be used to allow forward declarations of [[CatPgUserDefTypes User Defined Types]].


Revision [14452]

Edited on 2009-08-29 21:57:18 by CountingPine [Remove CamelCase links in "New to FreeBASIC"]
Additions:
- New to ""FreeBASIC""
Deletions:
- New to FreeBASIC


Revision [10146]

The oldest known version of this page was created on 2007-07-27 10:48:33 by JeffMarshall [Remove CamelCase links in "New to FreeBASIC"]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode