Re: [fpc-pascal] LLVM crash

2023-08-15 Thread Benito van der Zander via fpc-pascal
writing this mail) Then this: https://gitlab.com/freepascal.org/fpc/source/-/issues/40280 is causing a stack corruption https://gitlab.com/freepascal.org/fpc/source/-/issues/40392 is causing a heap corruption Cheers, Benito On 11.08.23 12:57, Jonas Maebe via fpc-pascal wrote: On 10/08/2023

Re: [fpc-pascal] LLVM LTO

2023-08-15 Thread Benito van der Zander via fpc-pascal
, Benito On 11.08.23 12:46, Jonas Maebe via fpc-pascal wrote: On 10/08/2023 17:06, Benito van der Zander via fpc-pascal wrote: I tried to use the LLVM Link-Time-Optimization, -Clflto I should update the wiki page. Under Debian 11, I can tell FPC to use gold with lto by specifying the following

[fpc-pascal] LLVM LTO

2023-08-11 Thread Benito van der Zander via fpc-pascal
Hallo, I tried to use the LLVM Link-Time-Optimization, -Clflto I compiled/installed fpc llvm with a separate prefix, which was already difficult to set up Then the default linker did not want to link it. The wiki says to use the gold linker. I do not know how to change the linker in

[fpc-pascal] LLVM crash

2023-08-10 Thread Benito van der Zander via fpc-pascal
Hallo, i tried to run my program under LLVM (from july fpc)  and it crashes? Program received signal SIGSEGV, Segmentation fault. 0x0042e5f1in SYSTEM_$$_SYSGETMEM_FIXED$QWORD$$POINTER() (gdb) bt #0 0x0042e5f1in SYSTEM_$$_SYSGETMEM_FIXED$QWORD$$POINTER() #1 0x0041b92ain

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-25 Thread Benito van der Zander via fpc-pascal
Hi, That 99.99% of people does use it, indicates they simply take the overhead because of the advantages that the managed types offer. Or they simply do not know about the overhead Like I was writing all my code on Windows 98, and never noticed any overhead, until I started running

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Benito van der Zander via fpc-pascal
. That is a very productive optimization idea Cheers, Benito On 24.05.23 13:10, Marco van de Voort via fpc-pascal wrote: On 24-5-2023 13:00, Benito van der Zander via fpc-pascal wrote: It is weird that your code calls setjmp? Are you using a non Windows platform?  Comparisons with Delphi should be done

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Benito van der Zander via fpc-pascal
, FPC could at least inline fpc_setjmp in fpc_pushexceptaddr to make it only one function call. I regret installing Linux. Everything worked better with Windows 98 and Delphi 4 Sincerely, Benito On 24.05.23 10:14, Marco van de Voort via fpc-pascal wrote: On 23-5-2023 12:44, Benito van der

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-22 Thread Benito van der Zander via fpc-pascal
Hi, The compiler will do this wrapping anyway if you use ansistrings, so the approach with e.g. a generic record will not cause a lot of overhead in most cases. But using strings or anything similar causes a lot of overhead It is really bad Bye, Benito On 21.05.23 18:03, Michael Van

[fpc-pascal] pointer to char vs pchar

2023-03-24 Thread Benito van der Zander via fpc-pascal
Hallo, why is a pointer to a char not a pchar (for type helpers)? program Project1; {$Mode objfpc}{$H+} {$ModeSwitch typehelpers} type TPcharHelper = type helper for pchar   function toString(length: integer): string; end; function TPcharHelper.toString(length: integer): string; begin  

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-07 Thread Benito van der Zander via fpc-pascal
Hi, https://gitlab.com/freepascal.org/fpc/source/-/issues/38703 I'm afraid that with -O4 it is by design. -O4 enables -OoUNCERTAIN, and the documentation about -OoUNCERTAIN notes that: “If uncertain optimizations are enabled, the CSE algorithm assumes that — If something is written to a

Re: [fpc-pascal] Compiler flag define or $IFOPT for optimizations

2022-06-03 Thread Benito van der Zander via fpc-pascal
tch on every commit. Best, Benito On 28.05.22 14:34, Tomas Hajny via fpc-pascal wrote: On 2022-05-28 13:44, Benito van der Zander via fpc-pascal wrote: Hi, I want to show how my program was compiled. Now I have string like "FPC3.2.2 i386-Linux R+C+" from   compiler := 'FPC' + {$INCLUD

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Benito van der Zander via fpc-pascal
Hi, Sort((left, right) begin if left < right then result := -1 else if left > right then result := 1 else result := 0; end); One could

[fpc-pascal] Compiler flag define or $IFOPT for optimizations

2022-05-28 Thread Benito van der Zander via fpc-pascal
Hallo, I want to show how my program was compiled. Now I have string like "FPC3.2.2 i386-Linux R+C+" from   compiler := 'FPC' + {$INCLUDE %FPCVERSION%} + ' ' + {$INCLUDE %FPCTargetCPU%}+'-'+{$INCLUDE %FPCTargetOS%}+ ' ' + {$IfOpt R+}+'R+'{$endif} {$IfOpt S+}+'S+'{$endif} {$IfOpt

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-14 Thread Benito van der Zander via fpc-pascal
Hi, I don’t see what the problem with a shortstring buffer is.. strtoint could not make use of an input string longer than 256 characters anyway, because the output integer could not have more than 19 digits anyway.. so an input string longer than this would be useless… just convert to a

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Benito van der Zander via fpc-pascal
Hi, If it is correct: Can we skip using ShortString buffer and have e.g. 'common' PChar base function for AnsiString/ShortString? I keep arguing for that as well You can always create such a function yourself,  gain experience using it, and share the source with us. I wrote that for

Re: [fpc-pascal] Where can I find working code for xidel and dependencies

2022-01-11 Thread Benito van der Zander via fpc-pascal
Hi, xquery.internals.common.pas(434,80) Fatal: Cannot find PasDblStrUtils used by xquery.internals.common of package internettools. that is here: github.com/bero1985/pasdblstrutils Download src/PasDblStrUtils.pas. Do not clone the repository when you have a slow internet connection It

Re: [fpc-pascal] Traits Proposal

2021-02-18 Thread Benito van der Zander via fpc-pascal
Hi, The problem is that, we like OOP inheritance but when we extend classes we are forced into a single hierarchy. there is another way to extend classes without inheritance: type helpers Traits are like reverse type helpers. With the type helper you first declare the class and then the

Re: [fpc-pascal] interfaces and smartpointers [was Traits Proposal]

2021-02-17 Thread Benito van der Zander via fpc-pascal
On 17.02.21 21:43, Ryan Joseph via fpc-pascal wrote: So where is your 10% performance hit coming from then? on init: InitInterfacePointers or TInterfacedObject.AfterConstruction? I benchmarked it years ago, I do not remember the details. But InitInterfacePointers was bad. Just look at it:

Re: [fpc-pascal] interfaces and smartpointers [was Traits Proposal]

2021-02-17 Thread Benito van der Zander via fpc-pascal
k to the class (sub    $0x20,%rdi) before calling the actual method. Because the class method assumes self is the class and not an interface Bye, Benito On 17.02.21 17:37, Ryan Joseph via fpc-pascal wrote: On Feb 17, 2021, at 8:27 AM, Benito van der Zander via fpc-pascal wrote: var

Re: [fpc-pascal] interfaces and smartpointers [was Traits Proposal]

2021-02-17 Thread Benito van der Zander via fpc-pascal
8 With many small objects it should be faster just because it fits better in the cache. Cheers, Benito On 17.02.21 14:31, Marco van de Voort via fpc-pascal wrote: Op 2021-02-17 om 00:02 schreef Benito van der Zander via fpc-pascal: And there often is a lot of unintentional deep copying. This is als

Re: [fpc-pascal] Traits Proposal

2021-02-16 Thread Benito van der Zander via fpc-pascal
Hi, And there often is a lot of unintentional deep copying. This is also why a property returning a record is fairly useless except for extremely small records like TPoint (and even that is not optimal no But a managed record to replace an interface, would only contain a single

Re: [fpc-pascal] Traits Proposal

2021-02-16 Thread Benito van der Zander via fpc-pascal
Hi, If you need to create 1000 class instances each frame then you have a flaw in your logic in my opinion. I have more like a million class instances For my XPath stuff, and every returned value is put in a variant-like class. Selecting all nodes on an GB large XML, could even create

Re: [fpc-pascal] Traits Proposal

2021-02-16 Thread Benito van der Zander via fpc-pascal
There are no significant performance implications of interfaces. They're essentially a virtual method call, something that one is doing all day long with Object Pascal classes. Interfaces are extremely slow. Virtual method calls are also slow. I have been using interfaces for reference

Re: [fpc-pascal] Question about System.Move()

2021-01-29 Thread Benito van der Zander via fpc-pascal
strings before your code and then decrementing the reference counts afterwards would probably work. The same probably applies to other reference count objects. Derek On Thu, Jan 28, 2021 at 11:35 AM Benito van der Zander via fpc-pascal <mailto:fpc-pascal@lists.freepascal.org>> wrote

Re: [fpc-pascal] Question about System.Move()

2021-01-27 Thread Benito van der Zander via fpc-pascal
calls,  which is around a third of 3*n*k Bye, Benito On 11.01.21 18:51, Sven Barth via fpc-pascal wrote: Benito van der Zander via fpc-pascal <mailto:fpc-pascal@lists.freepascal.org>> schrieb am Mo., 11. Jan. 2021, 15:26: Hi, perhaps a  safe, generic function for this copy

Re: [fpc-pascal] Question about System.Move()

2021-01-11 Thread Benito van der Zander via fpc-pascal
Hi, perhaps a  safe, generic function for this copying could be added to the RTL. Like: Procedure ManagedMove(const source: T;var dest: T;count: SizeInt); a) For non-managed types it would be the same as Move(source, dest, count*sizeof(T)) b) For reference counted types (like strings or

[fpc-pascal] CP_NONE string disappearing

2020-12-27 Thread Benito van der Zander via fpc-pascal
Hello, this code: program Project1; {$mode objfpc}{$H+} var a,b, c: string; begin   a := 'x';   b := 'y';   SetCodePage(RawByteString(b), CP_NONE, false);   c := a+b;   writeln(c); end. prints x without y on win32/wine. Is that supposed to happen? Bye, Benito

Re: [fpc-pascal] I'm working on automated Help Output for console apps

2020-11-20 Thread Benito van der Zander via fpc-pascal
Hi, I also made such a thing: var optionsreader: TCommandLineReader; begin   optionsreader := TCommandLineReader.create;   optionsreader.declareFile('file', 'The file to be processed');   optionsreader.addAbbreviation('f');   optionsreader.declareFlag('help', '');  

Re: [fpc-pascal] link.res search dirs when cross compiling [solved]

2020-11-18 Thread Benito van der Zander via fpc-pascal
wrote: Op 2020-11-18 om 19:21 schreef Benito van der Zander via fpc-pascal: where do the SEARCH_DIRs in link.res come from? Some are hardcoded, and fpc.cfg might contain -Fl lines with paths too from parsing ld.so.conf on install ___ fpc-pascal

Re: [fpc-pascal] link.res search dirs when cross compiling

2020-11-18 Thread Benito van der Zander via fpc-pascal
How are you specifying your cross-compilation sysroot? Make sure you use the -XR parameter for that, I use -Fl in ~/.fpc.cfg... When I use -XR nothing happens. The link.res is the same, except -Fl prepends the path to link.res and -XR just ignores it. (same for -Xr) Benito

[fpc-pascal] link.res search dirs when cross compiling

2020-11-18 Thread Benito van der Zander via fpc-pascal
Hi, where do the SEARCH_DIRs in link.res come from? My build has started failing, after trying it on a new computer with "/home/benito/bin/arm-linux-androideabi-ld.bfd:android/libs/armeabi/link42815.res:17: ignoring invalid character `'' in expression" link.res starts with:

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-09 Thread Benito van der Zander via fpc-pascal
They cannot be used on handles that do not support FileSeek() (sockets, pipes, stdin/stdout etc.). Well, it would be better if it could You can just incrementally resize the return array, when reading succeeds after seeking fails. I have a string load function doing that:

[fpc-pascal] json parsing: detecting invalid escape sequences

2020-09-29 Thread Benito van der Zander via fpc-pascal
Hi, I am supposed to find invalid escape sequences when parsing JSON and replace them with a user defined fallback. Invalid in the sense that the unicode codepoint is not defined or a missing surrogate, not syntactically invalid. For example, any occurrence of \u and \uDEAD should be

[fpc-pascal] json numbers with leading dots

2020-09-29 Thread Benito van der Zander via fpc-pascal
Hi, there are also two lines in the json scanner where it tries to repair numbers with leading dots '.123' to '0.123': If (FCurTokenString[1]='.') then   FCurTokenString:='0'+FCurTokenString; They should probably be removed. Not only are those numbers invalid in json, it is

Re: [fpc-pascal] json parser line numbers

2020-09-29 Thread Benito van der Zander via fpc-pascal
here: https://bugs.freepascal.org/view.php?id=37836 On 29.09.20 10:47, Michael Van Canneyt via fpc-pascal wrote: On Tue, 29 Sep 2020, Benito van der Zander via fpc-pascal wrote: Hi, the line numbering of the json parser has been changed recently. It used to say "Error at line 1&quo

[fpc-pascal] json parser line numbers

2020-09-29 Thread Benito van der Zander via fpc-pascal
Hi, the line numbering of the json parser has been changed recently. It used to say "Error at line 1"... when there was an error in the first line, but now it says "Error at line 0"... Was that on purpose, or can someone change it back? Benito

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-14 Thread Benito van der Zander via fpc-pascal
Hi, I would definitely keep it that way. As I see it: Redirection or not should not matter, the system should assume console output. Things like 'tee' make this concept dubious in any case: If you pipe output to a program, you don't expect the codepage to change because of the

Re: [fpc-pascal] Procedural generics question

2020-08-25 Thread Benito van der Zander via fpc-pascal
Hi, that is generating rather odd code (r40721) project1.lpr:9    begin 00401090 55   push   %rbp 00401091 4889e5   mov    %rsp,%rbp 00401094 488d6424f0   lea -0x10(%rsp),%rsp 00401099

Re: [fpc-pascal] optimization for strlicomp()

2020-06-01 Thread Benito van der Zander
Hi, I had a custom case-insensitive compare function, and it was very slow. Then I benchmarked it and noticed, case-insensitiveness is rarely needed in practice. Then I changed it to something like:   c1:=str1[counter];   c2:=str2[counter];   if c1 <> c2 then begin

Re: [fpc-pascal] fcl-passrc errors

2019-10-15 Thread Benito van der Zander
Hi, On 14.10.19 15:44, Ryan Joseph wrote: var it: pointer; obj: TObject; begin for it in list do begin obj := TObject(it); // continue on like before using “obj” instead of “it" end; That’s our realistic best use case now but it requires 2 extra steps. I hope

Re: [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Benito van der Zander
Hi, when I need maximal speed, I use jsonscanner of fpJSON. It should be vastly faster than a complete parser by not allocating memory or validating the json. Although it decodes all the strings in the JSON, which require some allocations, even if you do not need every string. It would be

Re: [fpc-pascal] CopyFile for FreePascal without Lazarus?

2019-04-18 Thread Benito van der Zander
Hi James, I have just copied the function from Lazarus to my project. Two days ago I even copied it in a new file: http://hg.benibela.de/internettools/file/f379759c52b9/data/xquery.internals.lclexcerpt.pas Best, Benito On 18.04.2019 03:06, James Richters wrote: Is there a copyfile for

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Benito van der Zander
Hi, since I need glasses, it is already troublesome to read a single screen. With strong glasses just one point on the screen is really sharp and when the glasses shift a little, you end up seeing only on one eye properly Cheers, Benito Am 16.04.19 um 22:17 schrieb Martin Wynne: I have

Re: [fpc-pascal] Optional param modifier

2019-04-13 Thread Benito van der Zander
Perhaps there could be the opposite modifier, so the function cannot be called with nil. Like Interesting idea but I’d have to think about it more to know if this is a real problem I’ve ever experienced. for example, I store some interfaces in a list, and just replaced the default list with

Re: [fpc-pascal] Using TInterfaceList and casting interfaces

2019-04-13 Thread Benito van der Zander
should be avoided, unless you actually need something thread-safe. The classes unit is full of weird stuff Best, Benito Am 07.04.19 um 20:24 schrieb Sven Barth via fpc-pascal: Benito van der Zander mailto:ben...@benibela.de>> schrieb am So., 7. Apr. 2019, 15:34: Writing (list

Re: [fpc-pascal] Optional param modifier

2019-04-13 Thread Benito van der Zander
Hi, the parameter is already optional without any modifier, since you can always pass nil for it. Perhaps there could be the opposite modifier, so the function cannot be called with nil. Like procedure DoThis(nonnil var obj: TObject); and then you need to check if it is nil, before

[fpc-pascal] Using TInterfaceList and casting interfaces

2019-04-07 Thread Benito van der Zander
Hi, how should one use TInterfaceList with other interfaces than IUnknown? Let's say we have a ISomeInterface derived from IUnknown. When we have an ISomeInterface, we can add it to the list fine, because an ISomeInterface is an IUnknown. But when we get it back from the list, it is an

Re: [fpc-pascal] CLI argument parsers

2019-01-14 Thread Benito van der Zander
I wrote one, too: http://benibela.de/sources_en.html#rcmdline Supports --linux=style and /windows style, and ' and " quotes On 14.01.2019 10:49, Yann Mérignac wrote: You can also try this: http://yann.merignac.free.fr/unit-cmdline.html It's a command line parser I wrote when I needed it a

Re: [fpc-pascal] inlining functions

2019-01-12 Thread Benito van der Zander
Hi,  something that appears  to help is to put units in the interface uses rather than the implementation uses. When the unit mentioned in the interface uses, uses the first unit in its implementation uses, it can inline the functions from the first unit. Although I would have expected it

Re: [fpc-pascal] Constants in generics

2019-01-08 Thread Benito van der Zander
Hi, that reminds me of https://bugs.freepascal.org/view.php?id=34232 Bye, Benito Am 08.01.19 um 23:28 schrieb Sven Barth via fpc-pascal: Am Di., 8. Jan. 2019, 21:01 hat Ryan Joseph mailto:r...@thealchemistguild.com>> geschrieben: I’ve made constants respect their proper definition

Re: [fpc-pascal] inlining functions

2019-01-02 Thread Benito van der Zander
ll inline functions in dependency cycles, unit A uses unit B that uses unit A. Then unit A can't inline something unit B. Any way around that? Best, Benito Am 02.01.19 um 00:41 schrieb Jonas Maebe: On 2019-01-02 00:19, Benito van der Zander wrote: procedure TStrBuilder.append(const s: Raw

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Benito van der Zander
iy Sydorov: On 29.12.2018 16:19, Benito van der Zander wrote: Hi, even if there's closed issue https://bugs.freepascal.org/view.php?id=34169 I would like to ask if it can be reconsidered. The subject is that SetLength now gives warning: Variable "dynamic array" of a manage

Re: [fpc-pascal] inlining functions

2019-01-01 Thread Benito van der Zander
lined end; Best, Benito Am 01.01.19 um 22:41 schrieb Jonas Maebe: On 01/01/19 22:38, Benito van der Zander wrote: and why is it not inlining the count and append call of this string builder? It is not using any implementation only function Routines can only be inlined if they are ca

Re: [fpc-pascal] inlining functions

2019-01-01 Thread Benito van der Zander
rveadd(l);   move(p^, next^, l);   inc(next, l); end; end. Bye, Benito Am 29.12.18 um 20:31 schrieb Sven Barth via fpc-pascal: Am Sa., 29. Dez. 2018, 15:23 hat Benito van der Zander mailto:ben...@benibela.de>> geschrieben: Hi, after updating from fpc 3.1 to

[fpc-pascal] inlining functions depending on implementation only functions

2018-12-29 Thread Benito van der Zander
Hi, after updating from fpc 3.1 to fpc 3.3, I am getting a lot of "function was not inlined" warnings, e.g. when an inline function depends on a function not declared in the interface part like: unit inlinetest; {$mode objfpc}{$H+} interface uses   Classes, SysUtils; function

Re: [fpc-pascal] SetLength warnings - request

2018-12-29 Thread Benito van der Zander
Hi, even if there's closed issue https://bugs.freepascal.org/view.php?id=34169 I would like to ask if it can be reconsidered. The subject is that SetLength now gives warning: Variable "dynamic array" of a managed type does not seem to be initialized in 3.3.1 and 3.1.1 while it doesn't

Re: [fpc-pascal] with in classes/records

2018-09-25 Thread Benito van der Zander
Hi, perhaps everything would be clearer, if the default property was accessed with ^  ? var wrapper: TWrapper; begin wrapper := TWrapper.Create; wrapper^ := THelperA.Create; end. Cheers, Benito Am 14.09.2018 um 10:50 schrieb Ryan Joseph: How should this syntax

Re: [fpc-pascal] Type helper for JNI pointers

2018-08-26 Thread Benito van der Zander
es type a = type pointer; type b = type pointer; compiles Cheers, Benito Am 23.08.2018 um 04:23 schrieb Andrew Haines via fpc-pascal: On 08/12/2018 07:42 AM, Benito van der Zander wrote: But this does not work, because fpc thinks jclass and jobject are the same type, so there is only

[fpc-pascal] Type helper for JNI pointers

2018-08-12 Thread Benito van der Zander
Hi, when you use JNI functions you always need to repeat "env" a lot: var   javaClass: jclass;   javaObj: jobject; begin   //javaClass := ...   javaObj := env^^.NewObject(env, javaClass)   env^^.DeleteLocalRef(env, javaObj); end; So I thought you could declare type helpers for jobject and

[fpc-pascal] testing if a float has a fractional part

2018-05-11 Thread Benito van der Zander
Hi, after all these discussions about the frac function, what is the best way to test if there is a fractional part? That is the most common thing I use frac for I have always used frac(x) = 0 Is that worse or better than int(x) = x  ? Benito

Re: [fpc-pascal] Stack alias for ARC like memory management?

2018-04-26 Thread Benito van der Zander
Hi, I totally agree that available libraries like the above are what attract (or keep existing) users to Pascal, not some minor syntactical  sugar. But syntax features attract the library developers that will write those attractive libraries Cheers, Benito On 25.04.2018 16:27, Dennis

Re: [fpc-pascal] Next language feature for pas2js...

2018-04-26 Thread Benito van der Zander
Hi, I would like to vote for pointer support... Cheers, Benito On 25.04.2018 15:20, Michael Van Canneyt wrote: Hello, Now that interface support has been added to the list of implemented language features of pas2js, we're looking to get feedback on what best to tackle next. This

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Benito van der Zander
Hi Fpc-pascal Users, I simply rely on my IDE (Lazarus, Visual Studio)  to complete long identifier names for me so that I don't have to. *shrugs*  but you still need to read the identifiers and when they are too long, that takes time, too How does that look? No idea how it looked, but

Re: [fpc-pascal] fgl unit, TFPSList needs DeleteRange

2017-12-10 Thread Benito van der Zander
Hi Michael Van, delete the elements one by one anyway, for instance for interfaces. that can still be speed up by range deletion.  First call _Release on them all, then remove them with move/fillchar. Bye, Benito ___ fpc-pascal maillist -

Re: [fpc-pascal] Using Pascal N-IDE (Android)

2017-12-05 Thread Benito van der Zander
Hi Paul, would it be hard to use those IDEs for other languages or can you plugin another interpreter? I have an interpreter with Android support, and have been looking for some syntax highlighting there for a while Cheers, Benito Am 05.12.2017 um 20:36 schrieb Paul Breneman: On

Re: [fpc-pascal] FPC 3.0.4 released!

2017-12-03 Thread Benito van der Zander
Hi,  SourceForge gives checksums, too: Cheers, Benito Am 30.11.2017 um 15:47 schrieb Tomas Hajny: On Thu, November 30, 2017 15:32, kardan wrote: Wow, both of you managed to avoid my actual question. :) On Thu, 30 Nov 2017 13:00:07 +0100 kardan wrote: How can I

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-23 Thread Benito van der Zander
Btw, anyone know about a BCD math implementation for Free Pascal, like it used to be implemented in DR CBASIC? (those were the days... ;-) ) I have one here: http://benibela.de/sources_en.html#bigdecimalmath Am 23.08.2017 um 02:16 schrieb Paul Nance: Turbo Pascal also had a BCD unit. On

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Benito van der Zander
Hi, very stupid defaults indeed. I just had a bug last week, because I was using TStringList as map and forgot to change it to case-sensitive Cheers, Benito Am 16.08.2017 um 15:48 schrieb Gabor Boros: 2017. 08. 16. 15:21 keltezéssel, Michael Van Canneyt írta: Because the quotes must be

Re: [fpc-pascal] Defining sonames?

2017-08-13 Thread Benito van der Zander
Hi, that reminds me of Synapse. It is always very confusing to people that they need to install libssl-dev to use https, and libssl does not work. Because libssl-dev contains libssl.so or so, while libssl only has libssl.so.1.0.0, which is not found... And then you tell people to install

Re: [fpc-pascal] Array clearing

2017-04-13 Thread Benito van der Zander
Hi Ryan, In the real world is anyone actually going to type that out every time? I’d bet most of us have an array class we use and ignore dynamic arrays all together because we all need basic operations like “add” and “remove”. I, for one, have a huge list of array utility functions:

Re: [fpc-pascal] Feature announcement: Management Operators

2017-03-04 Thread Benito van der Zander
Hi, with a function call: http://bugs.freepascal.org/view.php?id=30333 I had benchmark runs where it spend more time in the initializing function than doing any calculations Best, Benito On 03/04/2017 06:41 PM, Michael Van Canneyt wrote: On Sat, 4 Mar 2017, nore...@z505.com wrote:

Re: [fpc-pascal] TProcess usage and reading program output

2017-02-28 Thread Benito van der Zander
Hi, how would you handle large output and large stderr? When you read from one and it writes to the other, the read blocks. Then it keeps writing to the other buffer, till that is full, and then its write is blocked, and it is deadlocked. Probably check NumBytesAvailable before reading?

Re: [fpc-pascal] JSON Test Suite

2016-11-07 Thread Benito van der Zander
Hi, huh, why does the build suddenly fail? Well, FPC 3.0.0 does not have the joStrict option. It is only there in 3.1.1. Perhaps there should be two fpc parser entries. Best, Benito On 06.11.2016 17:34, Benito van der Zander wrote: Hi, it is better to use TJSONParser than GetJSON

Re: [fpc-pascal] JSON Test Suite

2016-11-06 Thread Benito van der Zander
Hi, it is better to use TJSONParser than GetJSON. GetJSON is defined as: procedure DefJSONParserHandler(AStream: TStream; const AUseUTF8: Boolean; out Data: TJSONData); Var P : TJSONParser; begin Data:=Nil; P:=TJSONParser.Create(AStream,[joUTF8]); try Data:=P.Parse; finally

Re: [fpc-pascal] Re: [Bulk] Re: Namespaces Support

2013-11-03 Thread Benito van der Zander
Then the John Douglas and Douglas McKey are running into the same issue. Both guys (while living on different parts of the world) created the same douglas namespace! That's why most languages use domains as namespace Then you would have net.delfire.douglas.* org.msegui.* and no collision

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-06 Thread Benito van der Zander
In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. Do you need to put a memory barrier around that, or does the critical section take care of that? On 10/06/2013 06:55 PM, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: On Sun, 6

Re: [fpc-pascal] Access site from app with login and password using http

2013-08-29 Thread Benito van der Zander
My Internet Tools (http://www.benibela.de/sources_en.html#internettools) are made for that. For example: uses simpleinternet; var i: IXQValue; begin for i in process(httpRequest(process('http://www.example.org/the/page/with/the/login/form', 'form(/form, {username: '+username+', password:

Re: [fpc-pascal] Re: [Lazarus] Should TObject or TComponent have a Comment property?

2013-07-12 Thread Benito van der Zander
Enough digression - if considered carefully a comment about the purpose of an object belongs in the object definition itself. I use Pasdoc for that On 07/12/2013 08:07 AM, vfclists . wrote: On 11 July 2013 23:07, Benito van der Zander ben...@benibela.de mailto:ben...@benibela.de wrote

[fpc-pascal] Feature proposal: function-based assignment operators

2013-03-28 Thread Benito van der Zander
Hi, quite often you need to change a value relatively to another value. For example: array1[array2[i]] := array1[array2[i]] + 42; Luckily this can be written as array1[array2[i]] += 42; Which is nice. However, sometimes you do not need addition, but the minimum. For example:

Re: [fpc-pascal] Re: Feature proposal: function-based assignment operators

2013-03-28 Thread Benito van der Zander
What's the benefit? Same benefit as += to := ... + You do not need to rewrite/compute the left side How will it affect existing code? Not at all, since old code using this, would not compile Last but not least, will you implement it? I can try On 03/28/2013 04:20 PM, leledumbo wrote:

Re: [fpc-pascal] Feature proposal: function-based assignment operators

2013-03-28 Thread Benito van der Zander
wrote: Am 28.03.2013 16:23, schrieb Benito van der Zander: Hi, quite often you need to change a value relatively to another value. For example: array1[array2[i]] := array1[array2[i]] + 42; Luckily this can be written as array1[array2[i]] += 42; Which is nice. However, sometimes you do

Re: [fpc-pascal] Feature proposal: function-based assignment operators

2013-03-28 Thread Benito van der Zander
the core developers to tolerate extra operators like ⌊ for floor(), and then working out how to implement them :-) Or allow unicode identifier, and than defining ⌊ for ⌊= would just be a special case of func= On 03/28/2013 04:45 PM, Mark Morgan Lloyd wrote: Benito van der Zander wrote: Hi

Re: [fpc-pascal] Feature proposal: function-based assignment operators

2013-03-28 Thread Benito van der Zander
I would use Pascal (not C) and write inc(array1[array2[i]],42); well, that won't help with min On 03/28/2013 06:14 PM, Jürgen Hestermann wrote: Benito van der Zander wrote: Luckily this can be written as array1[array2[i]] += 42; I would use Pascal (not C) and write inc(array1[array2[i

Re: [fpc-pascal] Feature proposal: function-based assignment operators

2013-03-28 Thread Benito van der Zander
or write In the real program I ended up with if array1[array2[i]]42 then array1[array2[i]] := 42; Then you have everything twice. And if you have to change i to j, you might forget to change one On 03/28/2013 06:26 PM, Jürgen Hestermann wrote: Benito van der Zander wrote: array1

[fpc-pascal] Re: fcl-xml

2013-03-15 Thread Benito van der Zander
Hi, What is the state of XPath? The readme says 'Should be fairly completed' - can I assume it works for simple tasks? If you need xpath, you might also want to look at my Internet Tools ( (http://benibela.de/sources_en.html#internettools), they contain a basically complete XPath 2