Am 2016-06-26 um 01:19 schrieb Karoly Balogh (Charlie/SGR):
> No. Local variables are not initialized by default. Managed type or not,
> doesn't make a difference.
This is not true.
Local variables of managed types are of course initialized!
If you declare
var S : String;
then it is of course
Hi,
On Sun, 26 Jun 2016, Jürgen Hestermann wrote:
Ok, scrap what I wrote before... :|
You are right about the managed types initialization. But then the
documentation needs to be corrected there too. But actually, result is not
a local var, but in fact a "special" parameter of the function. My
On Sunday 26 June 2016 12:09:58 Jc3bcrgen Hestermann wrote:
>
> The only exception (at least since FPC 3) is the function result
> which is totally unexpected.
> Why such an exception?
>
I don't think one could treat a function result as a normal local variable.
The reason why not to initialise
On 26/06/16 11:09, Jürgen Hestermann wrote:
Am 2016-06-26 um 01:19 schrieb Karoly Balogh (Charlie/SGR):
No. Local variables are not initialized by default. Managed type or not,
doesn't make a difference.
This is not true.
Local variables of managed types are of course initialized!
If you
Am 26.06.2016 12:10 schrieb "Jürgen Hestermann" :
>
> Am 2016-06-26 um 01:19 schrieb Karoly Balogh (Charlie/SGR):
> > No. Local variables are not initialized by default. Managed type or not,
> > doesn't make a difference.
>
> This is not true.
> Local variables of
Am 2016-06-26 um 14:13 schrieb Sven Barth:
> But also no word that it is true either, cause you're not declaring a
variable for the Result.
Of course I am declaring a variable:
function X : String;
Now the (local) variable "Result" is of type "String".
I use it in the same way as any other
Hi,
On 26/6/2016 7:20 μμ, Jürgen Hestermann wrote:
And because it is a manged type I could rely on the documentation
which says that managed types are initialized (with zero length/nil).
"Result" is used in the same way as a (local) variable.
What should make me think that it is different?
as
Am 2016-06-26 um 14:27 schrieb Karoly Balogh (Charlie/SGR):
> There's no exception. At least not specifically for Result. It is simply
> variable passed by reference from the caller side, therefore it's not
> initialized inside the function.
You mean when I have the following:
Hi,
On Sun, 26 Jun 2016, Jürgen Hestermann wrote:
> Am 2016-06-26 um 14:27 schrieb Karoly Balogh (Charlie/SGR):
> > There's no exception. At least not specifically for Result. It is simply
> > variable passed by reference from the caller side, therefore it's not
> > initialized inside the
On 26.06.2016 18:20, Jürgen Hestermann wrote:
> Am 2016-06-26 um 14:13 schrieb Sven Barth:
>> But also no word that it is true either, cause you're not declaring a
> variable for the Result.
>
> Of course I am declaring a variable:
>
> function X : String;
>
> Now the (local) variable "Result"
Addendum - what about a return value which is a class that implements an
interface?
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
David Emerson wrote:
> Which types do we need to initialize to null/nil/zero/'' when they are a
> function result?
Results of all types (managed or not) need to be set to "empty" if you
want them to return an "empty" result.
> I understand COM-style interfaces are also managed types, do they
Okay, making a new thread here, to ask one question:
Which types do we need to initialize to null/nil/zero/'' when they are a
function result?
- dynamic arrays
- ansistring
- unicodestring
- string, with {$H+} (but not string[length])
- records containing any of them
- anything else???
I
On 27/6/2016 3:55 πμ, David Emerson wrote:
Okay, making a new thread here, to ask one question:
Which types do we need to initialize to null/nil/zero/'' when they are
a function result?
- dynamic arrays
- ansistring
- unicodestring
- string, with {$H+} (but not string[length])
- records
14 matches
Mail list logo