[fpc-devel] Numeric error in the calculation of Variance

2017-12-24 Thread Anton Shepelev
Hello, all May I ask you if there is any chance of fixing the error in the Math unit that I reported here: https://bugs.freepascal.org/view.php?id=32804 and provided a patch? Here is a test case: Program Vartest; uses Math; const Size = 100; var dataS: array of Single; dataD: arr

Re: [fpc-devel] Numeric error in the calculation of Variance

2017-12-25 Thread Anton Shepelev
Michael Van Canneyt to Anton Shepelev: > > May I ask you if there is any chance of fixing > > the error in the Math unit that I reported here: > > > >https://bugs.freepascal.org/view.php?id=32804 > > > > and provided a patch? Here is a test case: >

Re: [fpc-devel] Optimization for 'mod'

2018-01-05 Thread Anton Shepelev
J. Gareth Moreton: > For example, code such as this: > >Minutes := t div 60; >Seconds := t mod 60; > > ...is badly optimised, Or not at all. > because the division is calculated twice (without > the patch, 't div 60' uses a reciprocal constant, > while 't mod 60' just uses 'DIV'), wher

[fpc-devel] FPProfiler

2018-02-18 Thread Anton Shepelev
Why is not FPProfiler shipped as a binary with the standard FreePascal distribution? I belive many users would appreciate it, especially those using Windows (as I am), where the standard Unix utilities are not readily available and require effort to in- stall and configure. Why does FPP

Re: [fpc-devel] FPProfiler

2018-02-19 Thread Anton Shepelev
Florian Klampfl to Anton Shepelev: >>Why is not FPProfiler shipped as a binary with the >>standard FreePascal distribution? >> >>Why does FPProfiler seem to depend on Lazarus? > >Is it usable meanwhile? I have not tried it, but asked this question when I found it

Re: [fpc-devel] FPProfiler

2018-02-19 Thread Anton Shepelev
Simon Ameis: >However I think, FPC should generate the profiling >code itself. Then there is no need to modify the >code before and after the compilation. Not, I think, for the naive light-weight profiling that FPProfiler offers. Its functionality is easily decoupled from that of the

Re: [fpc-devel] FPProfiler

2018-02-19 Thread Anton Shepelev
I wrote: >Begin a generic tool, a profiler that need not be >limited to a specific IDE. Correction: Being a generic tool, a profiler need not be limited to a specific IDE. -- Please, do not forward replies to the list to my e-mail. ___ fpc-devel ma

Re: [fpc-devel] Multiple variable initialization

2018-03-31 Thread Anton Shepelev
Ondrej Pokorny: > Is there a reason why multiple variable initial- > ization is forbidden? > > program Test; > var >A:Integer = 0; // allowed >B, C: Integer = 0; // not allowed > begin > end. > > Will a patch be applied that allows it? That means another complication of the language

Re: [fpc-devel] Multiple variable initialization

2018-03-31 Thread Anton Shepelev
Florian Klaempfl to Ondrej Pokorny: > > Anyway, my favorite example of non-pascalish > > syntax within FPC are the +=, -= etc. operators. > > I really don't understand how they made it into > > FPC if so many FPC developers are stubbornly > > against simple and helpful extensions :) > > T

[fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Hello, all FreePascal has many low-level cross-platform functions scattered over multiple .inc files but not consolilated into reusable cross-platform units. Consider, for example, the functions function do_read (h: longint; addr: pointer; len: longint) : longint; function do_write(h: longin

Re: [fpc-devel] "Blank slate" next version of FPC

2019-03-09 Thread Anton Shepelev
Sven Barth: > Pascal is a language where declaration and use of > variables is separated. It makes it easy to see what > variables are declared and what type they are. Inline > variables mess this up as a variable can be declared > somewhere inside the code. I use C++ to earn my living. I > kno

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Michael Van Canneyt to Anton Shepelev: > > function do_read (h: longint; addr: pointer; len: > > longint) : longint; function do_write(h: longint; addr: > > pointer; len: longint) : longint; > > I also don't see why you need this. You have this > functionali

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Marco van de Voort: > Really? So why can't you simply use untyped "file"? I am writing a TextRec driver that shall work with a bare THandle, e.g.: Program Test; uses TextDrv, SysUtils; var t: Text; s: AnsiString; h: THandle; begin h := FileOpen( 'C:\test.txt', fmOpenRead ); FdAsT

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Michael Van Canneyt about FileWrite and FileRead: > For these functions, you can get more info with > GetLastOSError, and use that to set InOutRes. Thank you, but how do I translate the return value of GetLastOSError into a value of InOutRes? The translation functions are privately implemented i

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-10 Thread Anton Shepelev
Michael Van Canneyt to Anton Shepelev: > > Thank you, but how do I translate the return value of > > GetLastOSError into a value of InOutRes? The > > translation functions are privately implemented in > > sysos.inc . > > You can copy them. It is open source, after

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-11 Thread Anton Shepelev
Sven Barth to Anton Shepelev: >>Since we already have cross-platform functions FileRead >>and FileWrite, would not it be useful to have them set the >>InOutRes variable, or to publish a facility for converting >>the value of GetLastOSError into an InOutRes value? > >

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-11 Thread Anton Shepelev
Sven Barth to Anton Shepelev: > > Writers of drivers for this Pascal-style I/O interface > > should have the ability to convert OS-specific error > > codes into InOurRes values, which are not even > > documented at: > > > >https://www.freepascal.or

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-12 Thread Anton Shepelev
I wrote: >> > Notice also that FreePascal's TextRec handling is >> > incompatible with that of Delphi. The TextRec >> > operations OpenFunc, InOutFunc, FlushFunc, and CloseFunc >> > return a longint, which Delphi interprets as the result >> > code but FreePascal ignores. Therefore, I must set >>

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-14 Thread Anton Shepelev
I wrote: > system.inc defines FileFunc as a procedure without a > return value: > >FileFunc = Procedure(var t : TextRec); > > whereas streamio.pp defines the same operations as > functions returning longint, e.g.: > >Function StreamRead(var F: TTextRec) : longint; Here are the relevant fr

Re: [fpc-devel] Fpc does not allow Chr() in type definition. Bug?

2020-11-08 Thread Anton Shepelev via fpc-devel
Bart: > Type > SubRange = Chr(1)..Chr(2); > begin > end. > > This compiles in TP 6.0 and Delphi 7.0, but fpc doesn't. It also compiles in BP 7.0, but why? I think it can work only if the compiler treats Chr(1) as a macro, not as a function. Does any dialect Pascal allow function invocations in

Re: [fpc-devel] Fpc does not allow Chr() in type definition. Bug?

2020-11-08 Thread Anton Shepelev via fpc-devel
I wrote to Bart: > > Type > > SubRange = Chr(1)..Chr(2); > > begin > > end. > > > > This compiles in TP 6.0 and Delphi 7.0, but fpc doesn't. > > It also compiles in BP 7.0, but why? I think it can work > only if the compilers treats Chr(1) as a macro, not as a > function. Does any dialect Pascal