You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/manual/cache/KeyPgFunctionPtr.wakka
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Data type that stores a pointer to a ##[[KeyPgFunction|FUNCTION]]## procedure re
16
16
{{fbdoc item="desc"}}
17
17
A ##[[KeyPgFunction|Function]]## pointer is a procedure pointer that stores the memory location of compiled code that returns a value. If no intializer is given the default initial value is zero (0).
18
18
19
-
The memory address for the ##[[KeyPgFunction|Function]]## procedure can be assigned to the variable by taking the address of a subroutine with ##[[KeyPgOpProcPtr|ProcPtr]]## or ##[[KeyPgOpAt|Operator @ (Address of)]]##.
19
+
The memory address for the ##[[KeyPgFunction|Function]]## procedure can be assigned to the variable by taking the address of a subroutine with ##[[KeyPgOpProcptr|ProcPtr]]## or ##[[KeyPgOpAt|Operator @ (Address of)]]##.
20
20
21
21
The procedure must match the same ##[[KeyPgFunction|Function]]## declaration as the declared ##[[KeyPgFunction|Function]]## pointer.
22
22
@@ -97,7 +97,7 @@ Print operation(4, @x3)
97
97
98
98
{{fbdoc item="see"}}
99
99
- ##[[KeyPgSub|Sub]]##
100
-
- ##[[KeyPgOpProcPtr|ProcPtr]]##
100
+
- ##[[KeyPgOpProcptr|ProcPtr]]##
101
101
- ##[[KeyPgOpAt|Operator @ (Address of)]]##
102
102
103
103
{{fbdoc item="back" value="CatPgStdDataTypes|Standard Data Types"}}
Member operator to overload memory deallocation process part provided by ##[[KeyPgOpDelete|Operator Delete Statement]]## when applying to a UDT (User Defined Type).
A pointer to memory that has been allocated by ##[[KeyPgOpNewOverload|New Overload]]## operator or ##**New[] Overload**## operator, the array-version of ##[[KeyPgOpNewOverload|New Overload]]## operator.
11
+
12
+
{{fbdoc item="desc"}}
13
+
The member operator ##**Delete Overload**## overloads the memory deallocation process part provided by the ##[[KeyPgOpDelete|Delete Statement]]## operator when applying to a UDT (User Defined Type). So the user can define its own memory deallocation process part.
14
+
But before that, the UDT instance destruction process part provided by the ##[[KeyPgOpDelete|Delete Statement]]## operator is not modified.
15
+
16
+
##**Delete[] Overload**## operator is the array-version of ##**Delete Overload**## operator and overloads the memory deallocation process provided by the ##**Delete[] Statement**## operator when applying to a UDT (User Defined Type).
17
+
18
+
Memory freed with ##**Delete Overload**## operator must have be allocated with ##[[KeyPgOpNewOverload|New Overload]]## operator. Memory freed with ##**Delete[] Overload**## operator must have been allocated with ##**New[] Overload operator**##, the array-version of ##[[KeyPgOpNewOverload|New Overload]]## operator. You cannot mix and match the different versions of the operators.
19
+
20
+
Member operators ##**Delete Overload**##, and ##**Delete[] Overload**## are always static, even if not explicitly declared (##[[KeyPgStaticMember|static]]## keyword is unnecessary but allowed). Thus, they do not have an implicit ##[[KeyPgThis|This]]## instance argument passed to them (because instance already been destroyed).
21
+
22
+
{{fbdoc item="ex"}}
23
+
See the ##[[KeyPgOpNewOverload|New Overload]]## operator examples.
24
+
25
+
{{fbdoc item="lang"}}
26
+
- Only available in the //[[CompilerOptlang|-lang fb]]// dialect.
{{fbdoc item="title" value="Operator New Overload"}}----
2
+
Member operator to overload dynamic memory allocation process part provided by ##[[KeyPgOpNew|Operator New Expression]]## when applying to a UDT (User Defined Type).
A pointer of type [[KeyPgAny|any]] [[KeyPgPtr|ptr]] to the start of the newly allocated memory.
14
+
15
+
{{fbdoc item="desc"}}
16
+
The member operator ##**New Overload**## overloads the dynamic memory allocation process part provided by the ##[[KeyPgOpNew|New Expression]]## operator when applying to a UDT (User Defined Type). So the user can define its own dynamic memory allocation process part.
17
+
But after that, the UDT instance construction process part provided by the ##[[KeyPgOpNew|New Expression]]## operator is not modified.
18
+
19
+
##**New[] Overload**## operator is the array-version of the ##**New Overload**## operator and overloads the dynamic memory allocation process provided by the ##**New[] Expression**## operator when applying to a UDT (User Defined Type).
20
+
21
+
Memory allocated with ##**New Overload**## operator must be freed with ##[[KeyPgOpDeleteOverload|Delete Overload]]## operator. Memory allocated with ##**New[] Overload**## operator must be freed with ##**Delete[] Overload**## operator, the array-version of ##[[KeyPgOpDeleteOverload|Delete Overload]]## operator. You cannot mix and match the different versions of the operators.
22
+
23
+
Member operators ##**New Overload**##, and ##**New[] Overload**## are always static, even if not explicitly declared (##[[KeyPgStaticMember|static]]## keyword is unnecessary but allowed). Thus, they do not have an implicit ##[[KeyPgThis|This]]## instance argument passed to them (because instance not yet been constructed).
24
+
25
+
{{fbdoc item="ex"}}
26
+
27
+
Aligned memory allocator:
28
+
- by using the member operators "New Overload" and "Delete Overload", any created User object is aligned to a multiple of "ALIGN" bytes (256 bytes in this example),
29
+
- the real pointer of the allocated memory is saved just above the User pointer, in the padding block.
0 commit comments