Re: [fpc-pascal] Weird absence of compilation error

2013-03-21 Thread OBones
Tomas Hajny wrote: What I was expecting is that the compilation fails in all cases. Is there some flag that I failed to specify? You can add {$X-} to the top (i.e. disable the so-called extended syntax allowing to treat functions like procedures) and then it fails. However, I think that it shoul

Re: [fpc-pascal] Weird absence of compilation error

2013-03-21 Thread OBones
Gerhard Scholz wrote: This must be read as follows: function Tmp: Double; begin Result := 10; // there is a semicolon (mispelling?) [statement 1] + Element;[statement 2] end; So, Result becomes 10. Yes, that's what happens and, yes it's a miss

Re: [fpc-pascal] Weird absence of compilation error

2013-03-21 Thread Tomas Hajny
On Thu, March 21, 2013 10:53, OBones wrote: Hello, > I'm using FPC 2.6.0 and have the following test program : > > program test; > > function Element: Double; > begin >Result := 4; > end; > > function Tmp: Double; > begin >Result := 10; + Element; > end; > > begin >WriteLn(Tmp); > en

Re: [fpc-pascal] Weird absence of compilation error

2013-03-21 Thread Gerhard Scholz
This must be read as follows: function Tmp: Double; begin Result := 10; // there is a semicolon (mispelling?) [statement 1] + Element;[statement 2] end; So, Result becomes 10. The next line is a function call without storing the result. The lea