Re: [fpc-pascal] Result: string

2013-03-06 Thread José Mejuto
El 06/03/2013 13:47, Jonas Maebe escribió: 2.6.0, 2.6.2 and 2.7.1 trunk produces a warning with that code, but with this one 2.6.0, and 2.7.1 trunk does not generate it (I do not have 2.6.2 to test): That's because you are passing an uninitialized value to a var-parameter. That only generates

Re: [fpc-pascal] Result: string

2013-03-06 Thread José Mejuto
El 06/03/2013 13:47, Jonas Maebe escribió: 2.6.0, 2.6.2 and 2.7.1 trunk produces a warning with that code, but with this one 2.6.0, and 2.7.1 trunk does not generate it (I do not have 2.6.2 to test): That's because you are passing an uninitialized value to a var-parameter. That only generates

Re: [fpc-pascal] Result: string

2013-03-06 Thread Jonas Maebe
On 06 Mar 2013, at 13:37, José Mejuto wrote: 2.6.0, 2.6.2 and 2.7.1 trunk produces a warning with that code, but with this one 2.6.0, and 2.7.1 trunk does not generate it (I do not have 2.6.2 to test): That's because you are passing an uninitialized value to a var- parameter. That only ge

Re: [fpc-pascal] Result: string

2013-03-06 Thread José Mejuto
El 06/03/2013 10:40, Jonas Maebe escribió: FPC 2.6.2 does give a warning (code is from http://bugs.freepascal.org/view.php?id=20907#c55064 ): [...] It could also fail in 2.6.x, just less often. Hello, 2.6.0, 2.6.2 and 2.7.1 trunk produces a warning with that code, but with this one 2.6.0,

Re: [fpc-pascal] Result: string

2013-03-06 Thread Jonas Maebe
On 05 Mar 2013, at 12:34, José Mejuto wrote: El 05/03/2013 11:23, Howard Page-Clark escribió: The code that makes me wonder something is wrong is this one: [...] For me (win32, FPC 2.6.2) the output is identical (= "A") whether or not Result in TheA() is initialised manually or not. P

Re: [fpc-pascal] Result: string

2013-03-05 Thread José Mejuto
El 05/03/2013 11:23, Howard Page-Clark escribió: The code that makes me wonder something is wrong is this one: [...] For me (win32, FPC 2.6.2) the output is identical (= "A") whether or not Result in TheA() is initialised manually or not. Perhaps 2.7.1 has a regression here if it differs fo

Re: [fpc-pascal] Result: string

2013-03-05 Thread Sven Barth
Am 05.03.2013 11:27, schrieb Michael Van Canneyt: On Tue, 5 Mar 2013, Howard Page-Clark wrote: On 04/03/13 10:33, José Mejuto wrote: The code that makes me wonder something is wrong is this one: --- {$mode objfpc} {$h+} procedure TheB(var aTheA: string); b

Re: [fpc-pascal] Result: string

2013-03-05 Thread Michael Van Canneyt
On Tue, 5 Mar 2013, Howard Page-Clark wrote: On 04/03/13 10:33, José Mejuto wrote: The code that makes me wonder something is wrong is this one: --- {$mode objfpc} {$h+} procedure TheB(var aTheA: string); begin aTheA:=aTheA+'A'; end; function TheA(): st

Re: [fpc-pascal] Result: string

2013-03-05 Thread Howard Page-Clark
On 04/03/13 10:33, José Mejuto wrote: The code that makes me wonder something is wrong is this one: --- {$mode objfpc} {$h+} procedure TheB(var aTheA: string); begin aTheA:=aTheA+'A'; end; function TheA(): string; begin //Result:=''; TheB(Result); en

Re: [fpc-pascal] Result: string

2013-03-04 Thread José Mejuto
El 04/03/2013 22:16, Michael Van Canneyt escribió: That report says the issue was assigned to Jonas and fixed in revision 20427 (ver 2.6.1). I find the current release (2.6.2) initialises a string function result to EmptyStr as you would hope. [...] Prints AA Hello, I'm asking because today

Re: [fpc-pascal] Result: string

2013-03-04 Thread Flávio Etrusco
On Mon, Mar 4, 2013 at 5:23 PM, Juha Manninen wrote: > On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: >> What's the expected output of this code ? >> >> function TheA(): string; >> begin >> Result:=Result+'A'; >> end; >> >> writeln(TheA()); >> >> I thought that when the result type is an au

Re: [fpc-pascal] Result: string

2013-03-04 Thread Juha Manninen
On Mon, Mar 4, 2013 at 10:51 PM, Howard Page-Clark wrote: > That report says the issue was assigned to Jonas and fixed in revision 20427 > (ver 2.6.1). > I find the current release (2.6.2) initialises a string function result to > EmptyStr as you would hope. Ok, that sounds good. I must have misu

Re: [fpc-pascal] Result: string

2013-03-04 Thread Michael Van Canneyt
On Mon, 4 Mar 2013, Howard Page-Clark wrote: On 04/03/13 8:23, Juha Manninen wrote: On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: What's the expected output of this code ? function TheA(): string; begin Result:=Result+'A'; end; writeln(TheA()); I thought that when the result type

Re: [fpc-pascal] Result: string

2013-03-04 Thread Howard Page-Clark
On 04/03/13 8:23, Juha Manninen wrote: On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: What's the expected output of this code ? function TheA(): string; begin Result:=Result+'A'; end; writeln(TheA()); I thought that when the result type is an automated one its value gets initialized..

Re: [fpc-pascal] Result: string

2013-03-04 Thread Juha Manninen
On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote: > What's the expected output of this code ? > > function TheA(): string; > begin > Result:=Result+'A'; > end; > > writeln(TheA()); > > I thought that when the result type is an automated one its value gets > initialized... Maybe I'm wrong... Ye

[fpc-pascal] Result: string

2013-03-04 Thread José Mejuto
Hello, What's the expected output of this code ? function TheA(): string; begin Result:=Result+'A'; end; writeln(TheA()); I thought that when the result type is an automated one its value gets initialized... Maybe I'm wrong... -- ___ fpc-pascal