Revision history for ProPgPointers


Revision [22768]

Last edited on 2019-07-04 00:29:40 by fxm [merged the page POINTER (KeyPgPointer) within page PTR (KeyPgPtr)]
Additions:
Pointers are [[ProPgVariables|Variables]] whose values are addresses in memory, and they are said to 'point' to this memory. The type of data that is pointed to depends on the type of pointer (an ##[[KeyPgInteger|Integer]] [[KeyPgPtr|Pointer]]## points to ##[[KeyPgInteger|Integer]]## data). Pointers are declared like any other variable, with the suffix "##pointer##" or "##ptr##" following the type name.
Deletions:
Pointers are [[ProPgVariables|Variables]] whose values are addresses in memory, and they are said to 'point' to this memory. The type of data that is pointed to depends on the type of pointer (an ##[[KeyPgInteger|Integer]] [[KeyPgPointer|Pointer]]## points to ##[[KeyPgInteger|Integer]]## data). Pointers are declared like any other variable, with the suffix "##pointer##" or "##ptr##" following the type name.


Revision [22213]

Edited on 2018-02-10 20:47:19 by JeffMarshall [merged the page POINTER (KeyPgPointer) within page PTR (KeyPgPtr)]
Additions:
{{fbdoc item="section" value="Assigning pointer variables"}}
A pointer is a memory address and the value of the pointer itself is that memory address. To assign a pointer variable is to assign it a memory address to something. One way to assign a pointer a memory address is to take the address of some other variable in the program using ##[[KeyPgOpAt|Operator @]]## (Address of).


Revision [21219]

Edited on 2016-03-13 14:07:02 by fxm [Formatting]
Additions:


Revision [20650]

Edited on 2016-02-10 16:13:10 by DkLwikki [Update link format]
Additions:
Pointers are [[ProPgVariables|Variables]] whose values are addresses in memory, and they are said to 'point' to this memory. The type of data that is pointed to depends on the type of pointer (an ##[[KeyPgInteger|Integer]] [[KeyPgPointer|Pointer]]## points to ##[[KeyPgInteger|Integer]]## data). Pointers are declared like any other variable, with the suffix "##pointer##" or "##ptr##" following the type name.
The data pointed to by a pointer can be accessed with ##[[KeyPgOpValueOf|Operator *]]## (Value of). This operator returns a reference to the data that its operand points to. The following,
defines an ##[[KeyPgInteger|Integer]]## variable called ##myInteger## and an ##[[KeyPgInteger|Integer]]## pointer called ##myPointer## that points to the location in memory where ##myInteger## is stored. ##[[KeyPgOpAt|Operator @]]## (Address of) is used to retrieve the address of ##myInteger##. The value of ##20## is assigned to the location at which ##myPointer## points - the address of ##myInteger##, or ##@myInteger##. Changes to ##*myPointer## directly affect the value of ##myInteger## (the expression "##*myPointer##" is the same thing as "##myInteger##").
Pointers to user-defined types are defined and used like all other pointers. Accessing a member of a [[KeyPgType|Type]] or [[KeyPgClass|Class]] requires one of the following two methods:
The first method uses ##[[KeyPgOpMemberAccess|Operator . (Member access)]]##. This operator accesses members from references, so the pointer is dereferenced first. The member access operator has higher priority over the dereference operator, so parenthesis are needed to dereference the pointer before using it with the member access operator.
The second method uses ##[[KeyPgOpPtrMemberAccess|Operator -> (Pointer to member access)]]##. This operator accesses members from pointers, which are automatically dereferenced. This can make code a little clearer, although both forms produce identical results.
- ##[[KeyPgOpAt|Operator @ (Address of)]]##
- ##[[KeyPgOpValueOf|Operator * (Value of)]]##
- ##[[KeyPgOpMemberAccess|Operator . (Member access)]]##
- ##[[KeyPgOpPtrMemberAccess|Operator -> (Pointer to member access)]]##
- ##[[KeyPgOpVarptr|Varptr]]##
- ##[[KeyPgOpStrptr|Strptr]]##
- ##[[KeyPgOpProcptr|Procptr]]##
Deletions:
Pointers are [[ProPgVariables Variables]] whose values are addresses in memory, and they are said to 'point' to this memory. The type of data that is pointed to depends on the type of pointer (an ##[[KeyPgInteger Integer]] [[KeyPgPointer Pointer]]## points to ##[[KeyPgInteger Integer]]## data). Pointers are declared like any other variable, with the suffix "##pointer##" or "##ptr##" following the type name.
The data pointed to by a pointer can be accessed with ##[[KeyPgOpValueOf Operator *]]## (Value of). This operator returns a reference to the data that its operand points to. The following,
defines an ##[[KeyPgInteger Integer]]## variable called ##myInteger## and an ##[[KeyPgInteger Integer]]## pointer called ##myPointer## that points to the location in memory where ##myInteger## is stored. ##[[KeyPgOpAt Operator @]]## (Address of) is used to retrieve the address of ##myInteger##. The value of ##20## is assigned to the location at which ##myPointer## points - the address of ##myInteger##, or ##@myInteger##. Changes to ##*myPointer## directly affect the value of ##myInteger## (the expression "##*myPointer##" is the same thing as "##myInteger##").
Pointers to user-defined types are defined and used like all other pointers. Accessing a member of a [[KeyPgType Type]] or [[KeyPgClass Class]] requires one of the following two methods:
The first method uses ##[[KeyPgOpMemberAccess Operator . (Member access)]]##. This operator accesses members from references, so the pointer is dereferenced first. The member access operator has higher priority over the dereference operator, so parenthesis are needed to dereference the pointer before using it with the member access operator.
The second method uses ##[[KeyPgOpPtrMemberAccess Operator -> (Pointer to member access)]]##. This operator accesses members from pointers, which are automatically dereferenced. This can make code a little clearer, although both forms produce identical results.
- ##[[KeyPgOpAt Operator @ (Address of)]]##
- ##[[KeyPgOpValueOf Operator * (Value of)]]##
- ##[[KeyPgOpMemberAccess Operator . (Member access)]]##
- ##[[KeyPgOpPtrMemberAccess Operator -> (Pointer to member access)]]##
- ##[[KeyPgOpVarptr Varptr]]##
- ##[[KeyPgOpStrptr Strptr]]##
- ##[[KeyPgOpProcptr Procptr]]##


Revision [11949]

The oldest known version of this page was created on 2007-12-21 14:54:07 by ElSairon [Update link format]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode