Revision history for KeyPgClear


Revision [22754]

Last edited on 2019-07-04 00:11:13 by fxm [merged the page POINTER (KeyPgPointer) within page PTR (KeyPgPtr)]
Additions:
**NOTE:** In order to clear memory referenced by a ##[[KeyPgPtr|Pointer]]##, it must be dereferenced first. Otherwise, ##**Clear**## will try to clear the bytes at the **pointer variable**'s memory location.
Deletions:
**NOTE:** In order to clear memory referenced by a ##[[KeyPgPointer|Pointer]]##, it must be dereferenced first. Otherwise, ##**Clear**## will try to clear the bytes at the **pointer variable**'s memory location.


Revision [20844]

Edited on 2016-03-12 15:38:36 by fxm [Formatting]
Additions:


Revision [20087]

Edited on 2016-02-10 15:55:35 by DkLwikki [Update link format]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Clear** [[KeyPgCdecl|cdecl]] ( [[KeyPgByref|byref]] //dst// [[KeyPgAs|as]] [[KeyPgAny|any]], [[KeyPgByval|byval]] //value// [[KeyPgAs|as]] [[KeyPgLong|long]] = 0, [[KeyPgByval|byval]] //bytes// [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]] )
**NOTE:** In order to clear memory referenced by a ##[[KeyPgPointer|Pointer]]##, it must be dereferenced first. Otherwise, ##**Clear**## will try to clear the bytes at the **pointer variable**'s memory location.
- ##[[KeyPgErase|Erase]]##
- ##[[KeyPgReset|Reset]]##
Deletions:
[[KeyPgDeclare declare]] [[KeyPgSub sub]] **Clear** [[KeyPgCdecl cdecl]] ( [[KeyPgByref byref]] //dst// [[KeyPgAs as]] [[KeyPgAny any]], [[KeyPgByval byval]] //value// [[KeyPgAs as]] [[KeyPgLong long]] = 0, [[KeyPgByval byval]] //bytes// [[KeyPgAs as]] [[KeyPgUinteger uinteger]] )
**NOTE:** In order to clear memory referenced by a ##[[KeyPgPointer Pointer]]##, it must be dereferenced first. Otherwise, ##**Clear**## will try to clear the bytes at the **pointer variable**'s memory location.
- ##[[KeyPgErase Erase]]##
- ##[[KeyPgReset Reset]]##


Revision [17482]

Edited on 2015-04-01 10:59:40 by DkLwikki [integer => long/uinteger]
Additions:
[[KeyPgDeclare declare]] [[KeyPgSub sub]] **Clear** [[KeyPgCdecl cdecl]] ( [[KeyPgByref byref]] //dst// [[KeyPgAs as]] [[KeyPgAny any]], [[KeyPgByval byval]] //value// [[KeyPgAs as]] [[KeyPgLong long]] = 0, [[KeyPgByval byval]] //bytes// [[KeyPgAs as]] [[KeyPgUinteger uinteger]] )
Deletions:
[[KeyPgDeclare declare]] [[KeyPgSub sub]] **Clear** [[KeyPgCdecl cdecl]] ( [[KeyPgByref byref]] //dst// [[KeyPgAs as]] [[KeyPgAny any]], [[KeyPgByval byval]] //value// [[KeyPgAs as]] [[KeyPgInteger integer]] = 0, [[KeyPgByval byval]] //bytes// [[KeyPgAs as]] [[KeyPgInteger integer]] )


Revision [16209]

Edited on 2012-06-23 08:55:29 by FxMwikki [Correct first example]
Additions:
clear array(0), , 100 * sizeof(integer)
Deletions:
clear array(1), , 100 * sizeof(integer)


Revision [13791]

Edited on 2008-10-21 18:34:30 by CountingPine [Pointer safety]
Additions:
**Clear**( //dst//, [//value//], //bytes// )
##**Clear**## sets one or more bytes in memory to a certain value (the default value is zero (##0##) if not specified). The starting address is taken from a reference to a variable or array element.
**NOTE:** In order to clear memory referenced by a ##[[KeyPgPointer Pointer]]##, it must be dereferenced first. Otherwise, ##**Clear**## will try to clear the bytes at the **pointer variable**'s memory location.
'create an array with 100 elements
dim array(0 to 99) as integer
'clear the contents of the array to 0, starting with the first element
clear array(1), , 100 * sizeof(integer)
'allocate 20 bytes of memory
dim as byte ptr p = allocate(20)
'set each of the first ten bytes to 0
clear *p, 0, 10
'set each of the next ten bytes to 42
clear p[10], 42, 10
'check the values of the allocated bytes
for i as integer = 0 to 19
print i, p[i]
next
'deallocate memory
deallocate p
- The behavior and usage is new to ""FreeBASIC""
- The keyword ##CLEAR## was used in QB to erase all variables, close all files, and optionally change the stack size. This use is not supported in ""FreeBASIC"".
Deletions:
**Clear**( //dst//, //value//, //bytes// )
##**Clear**## sets one or more bytes in memory to a certain value (the default value is zero (0) if not specified). The starting address is taken from a reference to a variable or array element.
dim array(1 to 100) as integer
clear array(1), 0, len(array(1)) * ubound(array)
-New to FreeBASIC
-The keyword ##CLEAR## was used in QB to erase all variables, close all files, and optionally change the stack size. This use is not supported in FreeBASIC.


Revision [11452]

The oldest known version of this page was created on 2007-11-09 16:17:40 by JeffMarshall [Pointer safety]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode