Revision history for KeyPgByref


Revision [22046]

Last edited on 2017-12-21 08:55:57 by fxm [Added warning on necessity to use fully compatible types between argument and parameter (when passing by reference)]
Additions:
**Warning:** When passing by reference, it is recommended to pass an argument of the same type (or fully compatible, like a derived type for example) as that of the declared parameter. Although in some cases the compiler accepts to pass a different type, often the result is not the one expected.


Revision [21501]

Edited on 2016-06-11 11:13:35 by fxm [Added the case of passing by reference of a constant or a literal expression]
Additions:
**Note:** A constant or a literal expression can also be passed to such a procedure (which gets by reference), but they are obviously not modifiable. In that case, the compiler passes by reference a temporary variable initialized with the constant or the literal expression.


Revision [21290]

Edited on 2016-04-01 08:04:02 by fxm [Added link to BYREF (variables)]
Additions:
- ##[[KeyPgByrefVariables|Byref (variables)]]##


Revision [20069]

Edited on 2016-02-10 15:55:06 by DkLwikki [Update link format]
Additions:
**Byref** //param// [[KeyPgAs|as]] [[DataType|datatype]]
[ [[KeyPgDeclare|declare]] ] { [[KeyPgSub|sub]] | [[KeyPgFunction|function]] } //proc_name// ( **Byref** //param// [[KeyPgAs|as]] [[DataType|datatype]] )
In //[[CompilerOptlang|-lang qb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, ##**Byref**## is the default parameter passing convention, unless ##[[KeyPgOptionbyval|Option ByVal]]## is in effect.
Opposite of ##[[KeyPgByval|ByVal]]##.
- In //[[CompilerOptlang|-lang fb]]// dialect, ##**Byval**## is the default parameter passing convention for all built-in types except ##[[KeyPgString|String]]## and user-defined ##[[KeyPgType|Type]]## which are passed ##[[KeyPgByref|Byref]]## by default.
- In //[[CompilerOptlang|-lang qb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, ##**Byref**## is the default parameter passing convention.
- [[ProPgPassingArguments|Passing Arguments to Procedures]]
- ##[[KeyPgDeclare|Declare]]##
- ##[[KeyPgByval|ByVal]]##
- ##[[KeyPgByrefFunction|Byref (function results)]]##
Deletions:
**Byref** //param// [[KeyPgAs as]] [[DataType datatype]]
[ [[KeyPgDeclare declare]] ] { [[KeyPgSub sub]] | [[KeyPgFunction function]] } //proc_name// ( **Byref** //param// [[KeyPgAs as]] [[DataType datatype]] )
In //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, ##**Byref**## is the default parameter passing convention, unless ##[[KeyPgOptionbyval Option ByVal]]## is in effect.
Opposite of ##[[KeyPgByval ByVal]]##.
- In //[[CompilerOptlang -lang fb]]// dialect, ##**Byval**## is the default parameter passing convention for all built-in types except ##[[KeyPgString String]]## and user-defined ##[[KeyPgType Type]]## which are passed ##[[KeyPgByref Byref]]## by default.
- In //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, ##**Byref**## is the default parameter passing convention.
- [[ProPgPassingArguments Passing Arguments to Procedures]]
- ##[[KeyPgDeclare Declare]]##
- ##[[KeyPgByval ByVal]]##
- ##[[KeyPgByrefFunction Byref (function results)]]##


Revision [16563]

Edited on 2013-01-28 15:22:12 by DkLwikki [Link to KeyPgByrefFunction]
Additions:
- ##[[KeyPgByrefFunction Byref (function results)]]##


Revision [16554]

Edited on 2013-01-28 14:28:10 by DkLwikki [Clarify that this BYREF is about parameters]
Additions:
{{fbdoc item="title" value="BYREF (parameters)"}}----
Deletions:
{{fbdoc item="title" value="BYREF"}}----


Revision [15895]

Edited on 2012-02-01 13:36:24 by FxMwikki [Wording]
Additions:
- In //[[CompilerOptlang -lang fb]]// dialect, ##**Byval**## is the default parameter passing convention for all built-in types except ##[[KeyPgString String]]## and user-defined ##[[KeyPgType Type]]## which are passed ##[[KeyPgByref Byref]]## by default.
Deletions:
- In //[[CompilerOptlang -lang fb]]// dialect, ##**Byval**## is the default parameter passing convention for all built-in types except ##[[KeyPgString String]]##; String and user-defined ##[[KeyPgType Type]]##s are passed ##[[KeyPgByref Byref]]## by default.


Revision [14266]

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


Revision [12855]

The oldest known version of this page was created on 2008-04-01 15:48:30 by JeffMarshall [Remove CamelCase links in "New to FreeBASIC"]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode