Re: [fpc-pascal] Partial text search in a dictionary

2017-05-15 Thread Jürgen Hestermann
Am 2017-05-15 um 13:14 schrieb Torsten Bonde Christiansen: > however I was hoping someone might know of an implementation that works more or less out of the box. To me it was very seldom that an existing solution severed all my needs. Either not all requirements were complied from the

Re: [fpc-pascal] machine readable grammar of object pascal?

2017-05-08 Thread Jürgen Hestermann
Am 2017-05-08 um 12:31 schrieb Marco van de Voort: In our previous episode, Michael Van Canneyt said: This is not something invented by FPC. It is something inherited from Turbo Pascal. And Delphi up to D4 iirc. Delphi inherited it from Turbo Pascal. Actually, it was a hack. Const defines end

Re: [fpc-pascal] Record operator for assignment

2017-05-08 Thread Jürgen Hestermann
Am 2017-05-08 um 05:47 schrieb nore...@z505.com: > It's similar to this feature: > x,y,z := 1, 12, 7 > It's neat to be able to assign multiple variables on a single line. But necessary? mandatory? It's not even neat. It would bloat the Pascal language unneccesarily (as many other additions have

Re: [fpc-pascal] WebAssembly Target

2017-04-20 Thread Jürgen Hestermann
Am 2017-04-20 um 10:25 schrieb Graeme Geldenhuys: > On 2017-04-14 09:41, Jürgen Hestermann wrote: >> I hate Java Script and use NoScript to block it. > You don't need a browser add-on for that. Simply go to (Firefox) > about:config and search for JavaScript. Double click the > &

Re: [fpc-pascal] Get value of PPChar ?

2017-04-17 Thread Jürgen Hestermann
Am 2017-04-16 um 19:45 schrieb fredvs: >> And how you'll need to use it will depend upon the function's documentation > With audio libraries there is a law: NO doc (other that the C header) and NO > demos. > So you must guess and explore all by your self. Now that's a useful working mode! No

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: *** GMX Spamverdacht *** Re: WebAssembly Target

2017-04-15 Thread Jürgen Hestermann
Am 2017-04-15 um 03:54 schrieb Ryan Joseph: > I think you’re confusing Java for JavaScript. JavaScript doesn’t allow execution of arbitrary code and as far as I know it’s still the only language that can manipulate the DOM on the browser to perform actions on the client side like changing the

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: *** GMX Spamverdacht *** Re: *** GMX Spamverdacht *** Re: WebAssembly Target

2017-04-14 Thread Jürgen Hestermann
Am 2017-04-14 um 15:12 schrieb Michael Van Canneyt: >> I want to keep control about what is executed on my computer. > So you are running an open source OS ? Unfortunately not (yet). I am working on getting rid of windows but some programs not available on Linux prevented me from doing this step

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: *** GMX Spamverdacht *** Re: WebAssembly Target

2017-04-14 Thread Jürgen Hestermann
Am 2017-04-14 um 13:53 schrieb Michael Van Canneyt: >> Why is it scripting needed to display a calendar? > To display a popup menu, for example. > Or completion when typing in an edit: when you invite someone, it's handy > when calendar suggests the contact name. I doubt that you can do this

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: WebAssembly Target

2017-04-14 Thread Jürgen Hestermann
Am 2017-04-14 um 11:03 schrieb Michael Van Canneyt: > On Fri, 14 Apr 2017, Jürgen Hestermann wrote: >> Am 2017-04-13 um 10:20 schrieb Michael Schnell: >> > So at the moment HTML5 and Java script is the way to go, but WebAssembly should recreate Action Script versatility per

Re: [fpc-pascal] WebAssembly Target

2017-04-14 Thread Jürgen Hestermann
Am 2017-04-13 um 10:20 schrieb Michael Schnell: > So at the moment HTML5 and Java script is the way to go, but WebAssembly should recreate Action Script versatility performance in a more "Standard" way. I hate Java Script and use NoScript to block it. I can't understand why scripting is needed

Re: [fpc-pascal] Array clearing

2017-04-13 Thread Jürgen Hestermann
Am 2017-04-12 um 16:30 schrieb Ryan Joseph: >> Array[High(Array)] := whateveryouwant; > SetLength(Array,Length(Array)+1); > Array[High(Array)] := … > In the real world is anyone actually going to type that out every time? Yes, I do this. Typing is not much work for me. My main focus is on

Re: [fpc-pascal] Array clearing

2017-04-12 Thread Jürgen Hestermann
Am 2017-04-12 um 16:36 schrieb Ryan Joseph: > Why magic? It seems silly the operator += doesn’t exist Well, are we using Pascal or C? ;-) > or even a basic operation set like “add”, “remove”, “insert” that every array implementation in every language has. > Aren’t those just function around

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: Array clearing

2017-04-12 Thread Jürgen Hestermann
Am 2017-04-12 um 16:47 schrieb Michael Van Canneyt: >> Type MyType = record >> A : Integer; >> B : array of char; >> C : array of Float; >> end; // of record >> ArrayA = array of MyType; >> ArrayB = array of ArrayA. >> >> What

Re: [fpc-pascal] Array clearing

2017-04-12 Thread Jürgen Hestermann
Am 2017-04-12 um 16:17 schrieb Ryan Joseph: > SetLength resizes the array in memory and “clear” means setting all values to default() for that type. "clear" is not very clear to me ;-) IMO SetLength(array,0) is clearing too. The function you want should be called "Fill". For example a function

Re: [fpc-pascal] Array clearing

2017-04-12 Thread Jürgen Hestermann
Am 2017-04-12 um 15:46 schrieb Ryan Joseph: > I agree. Dynamic arrays only advantage is they are managed by the compiler but they’re missing obvious functionality like adding/removing elements so they’re usually pretty useless. > Why was the functionality of appending an element to the end

Re: [fpc-pascal] Array clearing

2017-04-12 Thread Jürgen Hestermann
Am 2017-04-12 um 15:05 schrieb nore...@z505.com: > Since fillchar is not a general way to clear an item Define "clear". There are many things that can be named "clearing" (see below). > I've never been a fan of things like fillchar as it seems like a reinvention of something more like Clear()

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Jürgen Hestermann
Am 2017-04-04 um 16:54 schrieb Ryan Joseph: >> var arr : array of array of Integer; >> begin >> SetLength(arr, 10, 10); > “then the first array stores a pointer to each sub array.” > Could you illustrate this is code? > I don’t think I’m understanding this exactly like it’s represented in memory.

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Jürgen Hestermann
Am 2017-04-04 um 15:40 schrieb Ryan Joseph: > I’m glad I asked because of arrays of pointers is bad news for performance. I don't think that you will notice a performance issue with dynamic arrays (though it highly depends on the sizes and levels you use...) > Does SetLength on a single level

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Jürgen Hestermann
Am 2017-04-04 um 15:18 schrieb Jürgen Hestermann: > var MyArray : array of array of integer; > > you can do: > > SetLength(MyArray,3); > SetLength(MyArray[0],2); > SetLength(MyArray[1],3); > SetLength(MyArray[2],4); > > So MyArray[0] points to an array of 2

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Jürgen Hestermann
Am 2017-04-04 um 13:55 schrieb Ryan Joseph: > Doesn’t iterating the array default the purpose of FillChar? > The goal was the most efficient way clear the array with zero’s. > Even if the array if nested 3 levels deep (anArray[x][y][z]) > it should (I hope) be a contiguous block of memory that

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Jürgen Hestermann
Am 2017-04-04 um 12:51 schrieb Mark Morgan Lloyd: > On 02/04/17 10:00, Jonas Maebe wrote: >> Allocating new memory via setlength also clears the memory (+ the >> overhead of allocating the memory). > Jonas, is it still the case that if SetLength() results in existing data being moved that the

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Jürgen Hestermann
Am 2017-04-01 um 19:42 schrieb wkitt...@windstream.net: > consider this: when using a string var and writing to a binary file... > you reuse the string var for each value written... > if you don't clear the string var between fills then the binary will > contain "garbage" in the unused positions

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Jürgen Hestermann
Am 2017-04-01 um 15:09 schrieb Ryan Joseph: > Because the array is being iterated and I need to know which values are set. > Basically I have a dynamic array I grow to a certain size and this process happens in a loop. > The options are to allocate/free the array every cycle or clear memory

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Jürgen Hestermann
I am wondering what the purpose of filling all array elements with zero's could be. If I want to discard all elements I would simply delete the whole array (setlength(MyArray,0) ). But when should it be useful to keep all elements and just overwrite them all with zero's (which is also very time

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Jürgen Hestermann
Am 2017-02-21 um 22:12 schrieb James Richters: > I have a freepascal Windows console application that I recently ported over from DOS Turbo Pascal. I am have a small settings file that I write to disk that keeps getting corrupted. It happens only occasionally, but it’s always this one file,

Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?

2017-02-14 Thread Jürgen Hestermann
Am 2017-02-14 um 16:02 schrieb Tim Veldhuizen: On 14/02/17 20:00, fredvs wrote: It is a difficult task to speak with gurus. Nah, it's not. They are also people... I think.. Actually, I've never seen proof that they all are, so some may actually be chimps. :) Anyway, some are standing on such

Re: [fpc-pascal] KeyDown routine and Ctrl+Q

2017-02-09 Thread Jürgen Hestermann
Am 2017-02-09 um 14:42 schrieb Vojtěch Čihák: Strange. I tested in Linux+Qt and in Delphi7 (under Wine) and both have ssCtrl in Shift when I press Ctrl (i.e. Key=17). Well, I looked at Shift in the debugger and I could swear that it showed me an empty set []. But now I can't reproduce it

Re: [fpc-pascal] KeyDown routine and Ctrl+Q

2017-02-09 Thread Jürgen Hestermann
Am 2017-02-08 um 23:26 schrieb Vojtěch Čihák: > when you press CTRL+Q you will obtain two OnKeyDown events. The first with Key=17 (it is CTRL) and the second with Key=81 (Q). Both events will have ssCtrl in Shift. Yep, it makes sense for OnKeyDown. Thanks for the explanation. I don't know why

[fpc-pascal] KeyDown routine and Ctrl+Q

2017-02-08 Thread Jürgen Hestermann
I use a KEYDOWN routine in my main TFORM to check for the key Ctrl+Q: - procedure TForm1.FormKeyDown(Sender : TObject; var Key: Word; Shift : TShiftState); begin //

Re: [fpc-pascal] IsValidIdent() and identifiers escaped with

2017-02-05 Thread Jürgen Hestermann
Am 2017-02-05 um 20:26 schrieb Sven Barth: > Is that a valid identifier? > Here > http://wiki.lazarus.freepascal.org/Identifiers > it says: > Rules for identifiers: > Must begin with a letter from the English alphabet or an underscore (_). > Can be followed by alphanumeric characters

Re: [fpc-pascal] IsValidIdent() and identifiers escaped with

2017-02-05 Thread Jürgen Hestermann
Am 2017-02-05 um 15:24 schrieb Howard Page-Clark: var : boolean; Is that a valid identifier? Here http://wiki.lazarus.freepascal.org/Identifiers it says: Rules for identifiers: * Must begin with a letter from the English alphabet or an underscore (_). * Can be followed by alphanumeric

Re: [fpc-pascal] for loop vs while loop

2017-02-01 Thread Jürgen Hestermann
Am 2017-02-01 um 12:49 schrieb Graeme Geldenhuys: > Just curious (been in a discussion with somebody else). Is there a > performance difference between a FOR loop and a WHILE loop? > Not sure if it will make a difference, but the usage is with three > nested loops, iterating over some 300,000

Re: [fpc-pascal] Deleting 'Nonexistent' files under windows

2017-01-25 Thread Jürgen Hestermann
Am 2017-01-25 um 11:08 schrieb Jürgen Hestermann: I have written a file manager which uses the (Unicode) Windows API with \?\\ syntax and I never had any problems deleting long paths (testet up to 35,000 characters) Sorry, the number of tested characters wasn't 35,000 but about 25,000. Still

Re: [fpc-pascal] Deleting 'Nonexistent' files under windows

2017-01-25 Thread Jürgen Hestermann
Am 2017-01-24 um 18:44 schrieb Bart: I once created a folder and file using W API and \?\\ syntax for testing purposes. This all went well, but Windows did not like it and would not let me remove the file and folder. I rewote my test program to remove them, but still Windows refused. (The

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread Jürgen Hestermann
Am 2017-01-20 um 07:52 schrieb Martin Schreiber: > On Thursday 19 January 2017 22:50:36 fredvs wrote: >> function array_in_out(arrayin: TArFloat): TArFloat; >> begin >> result := arrayin; >> end; > Do you change items of "arrayin" later? If so the items of the result array > will be changed too,

Re: [fpc-pascal] FPC clean room project

2017-01-02 Thread Jürgen Hestermann
Am 2017-01-02 um 06:23 schrieb Mr Bee: > There's someone accusing that Free Pascal (and some parts of Lazarus) is just a reverse engineering of Delphi. Even he said some codes of FPC/Laz are taken from Delphi (and Kylix). This is a serious allegation. > I know that isn't true. Or is it? ;) >

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-05 Thread Jürgen Hestermann
Am 2016-12-04 um 14:09 schrieb Graeme Geldenhuys: > On 2016-12-04 11:30, Martin Schreiber wrote: >> That happens with every reallocmem() with FPC memory manager so using a >> getmem() block instead of a dynamic array has no advantage in this > Maybe a good old linked list implementation is the

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Jürgen Hestermann
I am still not sure how exactly elastic tab stops work. I put standard tabs (#9) in each line and the editor aligns these tabs for adjacent lines? What if an empty line is between such lines? What if I want to start a new 'table' which is not related to preceeding or following lines? In this

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-21 Thread Jürgen Hestermann
Am 2016-11-21 um 15:46 schrieb Graeme Geldenhuys: The age old rule of programmer source code always being in a mono-spaced font is ridiculous for this day and age. Why? I like monospaced fonts for code very much. Code is not a novel or a newspaper where you read a lot of text from top down to

[fpc-pascal] FindFirstFileNameW missing from Windows unit

2016-11-11 Thread Jürgen Hestermann
The subject says it allready: Is there a reason that the Windows API function FindFirstFileNameW is not defined in the Windows unit? I had to define it myself to use it but I think it should be available directly. ___ fpc-pascal maillist -

Re: [fpc-pascal] A serious Memleak using delegates/implements

2016-10-07 Thread Jürgen Hestermann
Am 2016-10-07 um 13:29 schrieb stdreamer: > Erm knifes are easy to use as well but cutting your self with one is your problem to solve. Today many industrial (and household) machines are a lot safer than decades ago. This has changed because so many people got (heavily) injured. Therefore these

Re: [fpc-pascal] String concatenation failure (again)

2016-08-03 Thread Jürgen Hestermann
Am 2016-08-02 um 20:12 schrieb José Mejuto: > Check the length of the string I think you have a NULL char at the end of every string, so only the first one (up to #00 char) is displayed. Yes, you are right. When I change the code for i := Low(Liste) to High(Liste)

Re: [fpc-pascal] String concatenation failure (again)

2016-08-02 Thread Jürgen Hestermann
Am 2016-08-02 um 12:25 schrieb Jürgen Hestermann: > -- > type MyStringType = string; > var S : MyStringType; > Liste : array of MyStringType; > i : SizeInt; > > begin > [..] // "Liste" is setup with many st

[fpc-pascal] String concatenation failure (again)

2016-08-02 Thread Jürgen Hestermann
I just came accross another issue of string concatenation within my program that worked okay before FPC 3 but fails after updating to FPC 3. I had not used this function since the update so I found the problem only now (by accident): -- type MyStringType =

Re: [fpc-pascal] which "managed" result types require extra work?

2016-06-28 Thread Jürgen Hestermann
Am 2016-06-28 um 01:13 schrieb David Emerson: > The source of my confusion -- and I suspect that of many others -- is that I always assumed a function result was treated like a local variable within the function, rather than a parameter to the function. > Since managed types are automatically

Re: [fpc-pascal] reference-counted function results not initialized to nil

2016-06-26 Thread Jürgen Hestermann
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:

Re: [fpc-pascal] reference-counted function results not initialized to nil

2016-06-26 Thread Jürgen Hestermann
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

Re: [fpc-pascal] reference-counted function results not initialized to nil

2016-06-26 Thread 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 managed types are of course initialized! If you declare var S : String; then it is of course

Re: [fpc-pascal] reference-counted function results not initialized to nil

2016-06-25 Thread Jürgen Hestermann
Am 2016-06-25 um 09:23 schrieb Maciej Izak: > 2016-06-25 5:19 GMT+02:00 Michalis Kamburelis : > They were never guaranteed to be initialized to nil. > Result has special logic for string, dynamic array, method pointer and variant (well documented ;) ): > "For a

Re: [fpc-pascal] Bls: Bls: Quick Modern Object Pascal Introduction, for Programmers

2016-06-21 Thread Jürgen Hestermann
Am 2016-06-21 um 17:16 schrieb Sven Barth: > It was decided some time ago when mode Delphi was switched to H+ (due to Delphi compatibility) that mode ObjFPC won't be switched, cause for that mode we value backwards compatibility higher than the user not having to write a switch. This is quite

Re: [fpc-pascal] Type helper for array

2016-06-09 Thread Jürgen Hestermann
Am 2016-06-09 um 20:18 schrieb Sven Barth: > Am 09.06.2016 17:57 schrieb "Vojtech Cihák" : > > aBuffer.Clear; > > Is it possible to do this without helper? > > You can always set the array to Nil IMO SetLength(aBuffer,0) would the most natural way to clear the array.

Re: [fpc-pascal] String theory

2016-05-10 Thread Jürgen Hestermann
Am 2016-05-10 um 17:48 schrieb Tony Whyman: I don't think this is what I meant as StringCodePage is a unicode string function. I am looking at the single byte string types. On 10/05/16 14:15, Bart wrote: It already is [part of the string type. See the StringCodePage function. Codepages

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-18 Thread Jürgen Hestermann
Am 2016-04-18 um 11:33 schrieb Sven Barth: Am 18.04.2016 07:58 schrieb "Jürgen Hestermann" <juergen.hesterm...@gmx.de <mailto:juergen.hesterm...@gmx.de>>: > And why was a directive implemented to use 0-based indices > even for strings but none for 1-based indi

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-18 Thread Jürgen Hestermann
Am 2016-04-18 um 09:53 schrieb Marco van de Voort: Limits like in for i:=0 to someexpression.count-1 are evaluated as expression before using the result to for. If count=0 this would become for i:=0 to $, so you need to guard this with a if count>0 then. Well, for 1-based arrays it

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-17 Thread Jürgen Hestermann
Am 2016-04-16 um 19:39 schrieb Dmitry Boyarintsev: > The problem is with using "unsigned" as an index (rather than zero- vs one- based arrays) > Take a while loop as an example, where index can change multiple times. > Current solution: > while i>=0 do > if cond then dec(i); > dec(i); > end;

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-16 Thread Jürgen Hestermann
Am 2016-04-16 um 18:36 schrieb Marco van de Voort: >> Yes, but I could store indices in DWORD if they would be 1-based >> and would not risk an exception if the index is "not valid" (which >> would be 0 in this case while it's -1 for 0-based indices). > You would have to check everywhere before

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-16 Thread Jürgen Hestermann
Am 2016-04-15 um 20:35 schrieb Sven Barth: Am 15.04.2016 18:37 schrieb "Jürgen Hestermann" <juergen.hesterm...@gmx.de <mailto:juergen.hesterm...@gmx.de>>: > > Another advantage of having 1-based indeces in dyn. arrays > would be that you could store indeces in u

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-15 Thread Jürgen Hestermann
Another advantage of having 1-based indeces in dyn. arrays would be that you could store indeces in unsigned integers while with 0-based indices high() may give -1. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-15 Thread Jürgen Hestermann
Am 2016-04-15 um 10:26 schrieb Graeme Geldenhuys: >> Is there also a switch >> {$OneBasedDynArrays On} ? >> No more confusion about first and last element index. > You really should be using low() and high() instead. ;-) So why do we need {$ZeroBasedStrings On} at all? ;-) Of course, when you

Re: [fpc-pascal] Any chance to add the TStringBuilder to FCL?

2016-04-14 Thread Jürgen Hestermann
Am 2016-04-14 um 23:22 schrieb Graeme Geldenhuys: > On 2016-04-14 19:27, Sven Barth wrote: >> We already have zero based strings in 3.0.0 if {$ZeroBasedStrings On} is >> used (it's a local switch). > Wow, learnt something new again. Never new that existed. Me too. Though I will not use it. Is

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: Bls: Bug in FPC 3.0.0

2016-03-06 Thread Jürgen Hestermann
Am 2016-03-06 um 17:00 schrieb Serguei TARASSOV: > You're right there are many language specific forums but English became these > standard "in fact". I see the trend of last 10 years when Russian developers > who lived in Russia write yours blogs in English only. > Sad but c'est la vie...

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Jürgen Hestermann
Am 14.02.2016 um 12:56 schrieb Florian Klaempfl: > No really. It is not a matter of +1 vs. inc but how it is compiled: as > add or lea. And the decision add vs. lea is not straight forward. It > depends on the surrounding code and the exact core. After reading this (especially the comments)

Re: [fpc-pascal] Please someone explain this to me

2016-02-14 Thread Jürgen Hestermann
Am 2016-02-11 um 14:21 schrieb Sven Barth: > If they are just learning the language then they shouldn't poke around in the core units anyway. That's what the documentation and help is for. > Back when I started learning TP I didn't have the internet and I didn't have the sources of the units. I

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: Please someone explain this to me

2016-02-14 Thread Jürgen Hestermann
Am 2016-02-14 um 12:28 schrieb Michael Van Canneyt: > There is a difference between learning the language, which implies knowing > what routines are available to you, and understanding how a particular routine works in detail. The latter requires you to study the source code. > For the former,

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Jürgen Hestermann
Am 2016-02-13 um 21:59 schrieb Paulo Costa: > On my PC with Windows 8.1, fpc 2.6.4 32bits, when I changed the line: > inc(TicketsCount); > to: > TicketsCount := TicketsCount + 1; > the results improved from: > C:\tmp\tests>HappyTickets.exe > Found 4816030 tickets. Elapsed time, msec: 323 > to >

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Jürgen Hestermann
Am 2016-02-02 um 11:41 schrieb Mark Morgan Lloyd: > Michael Van Canneyt wrote: > Yes, and that's why to get the desired semantics it's more appropriate to use if then else rather than iif() etc. > Please correct me if I'm wrong, but my understanding is that in all cases where parameters are

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Jürgen Hestermann
Am 2016-02-02 um 18:39 schrieb Maciej Izak: Is possible to close thread on mailing list? -,- Simply do not open (and delete) mails with "IfThen" in subject. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-01 Thread Jürgen Hestermann
Am 2016-02-01 um 16:27 schrieb Michael Van Canneyt: > Never, and if Delphi didn't have it, I would oppose its introduction as well. It is a result of a 'whatever goes' attitude. > Why not introduce C syntax, while we're at it ? Or Perl, or Javascript or whatever just happens to be the fashion

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: Pascal Lexical Diagrams

2016-02-01 Thread Jürgen Hestermann
Am 2016-01-30 um 20:44 schrieb Michael Van Canneyt: I can only concur with what Ewald writes. Are the Latex sources for the documenation available somewhere for download? I would like to check why the syntax diagrams created with the syntax.sty are incorrect and how they can be improved.

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-01 Thread Jürgen Hestermann
Am 2016-02-01 um 19:45 schrieb Dmitry Boyarintsev: No matter what the language is, developers still want to write C... for the shortness of script Such people should simply use C. Pascal <> C and I am glad that this is true. ___ fpc-pascal

Re: [fpc-pascal] Methods for autoupdating fpc programs?

2015-10-05 Thread Jürgen Hestermann
Am 2015-10-04 um 19:11 schrieb mic...@gmail.com: But that makes no sense to me. If the OS is designed to potentially remove running programs (or parts of it) from memory it cannot allow overwriting the file on disk in any case. When it does so, it cannot remove parts from memory because it may

Re: [fpc-pascal] Methods for autoupdating fpc programs?

2015-10-04 Thread Jürgen Hestermann
Am 2015-10-04 um 15:41 schrieb Mark Morgan Lloyd: Michael Van Canneyt wrote: On Sun, 4 Oct 2015, Graeme Geldenhuys wrote: On 2015-10-04 13:16, Mattias Gaertner wrote: Replacing a running program by simply copying can result under Linux in 'text file busy'. Then consider me luckily. :) In

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: *** GMX Spamverdacht *** Re: SizeInt documentation

2015-06-22 Thread Jürgen Hestermann
Am 2015-06-21 um 20:16 schrieb leledumbo: A documenation of a type that has different meanings on different platforms should tell about this. That's what a documentation is for! Well, the user guide, programmer's reference or basically everything other than the API documentation mentions

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: SizeInt documentation

2015-06-21 Thread Jürgen Hestermann
Am 2015-06-21 um 16:25 schrieb leledumbo: but the documentation says that it is always Longint. Can someone please correct this as it causes a lot of confusion. fpdoc parser understands and interprets compiler directives, so it can't display something that's defined differently for each

[fpc-pascal] SizeInt documentation

2015-06-21 Thread Jürgen Hestermann
The documenation in http://www.freepascal.org/docs-html/rtl/system/sizeint.html says: --- SizeInt Signed integer type which fits for sizes Declaration Source position: systemh.inc line 251 type SizeInt= LongInt

[fpc-pascal] Managed types within records

2015-05-28 Thread Jürgen Hestermann
Hi, when I have a record which has managed types (i.e. strings), how are they handled by the compiler when I assign one record to the other? Example: --- type MyRecordType = record X : SizeInt;

Re: [fpc-pascal] File handling: the TFileStream or the classical way is faster and more efficient?

2015-05-27 Thread Jürgen Hestermann
Am 2015-05-27 um 09:38 schrieb Michael Schnell: On 05/26/2015 06:25 PM, Jürgen Hestermann wrote: If you copy thousands of files with only a few bytes each then it may become very noticable, what else is done (in additon to the pure OS copy of the files). I don't think so. Opening the file

Re: [fpc-pascal] File handling: the TFileStream or the classical way is faster and more efficient?

2015-05-26 Thread Jürgen Hestermann
Am 2015-05-26 um 10:27 schrieb Michael Schnell: As the work that needs to be done by the OS is a lot more than what is done by the fpc library, I suppose that there is no noticeable difference. I think that depends on the size of the file(s). If you copy thousands of files with only a few

Re: [fpc-pascal] Truncate procedure unable to work under Linux, is this a bug?

2015-05-18 Thread Jürgen Hestermann
Am 2015-05-18 um 09:30 schrieb Michael Van Canneyt: Function FileTruncate (Handle: THandle; Size: Int64) : boolean; but even that does not work with files 2Gb on unix, because the underlying system call does not support it. I don't know what happens on Windows. On windows it should be

Re: [fpc-pascal] Mode Delphi and functions as parameters.

2015-03-21 Thread Jürgen Hestermann
Am 2015-03-21 um 11:04 schrieb Constantine Yannakopoulos: PS: I tend to always use the () notation when invoking functions with no arguments so it will be clear to a future reader that I'm invoking a function and not assigning some variable. This should be the job of the langugage

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-12 Thread Jürgen Hestermann
Am 2015-03-10 um 17:40 schrieb Sven Barth: It mutes the warning with the ID 5089 (the ID can be seen with -vq). So as long as the managed and unmanaged ones use the same warning ID (AFAIR they do) they will both be silenced. Ups, no, they are different. So at least if you use a current 2.7.1

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-11 Thread Jürgen Hestermann
Am 2015-03-10 um 18:52 schrieb Florian Klämpfl: Using dyn. arrays without initialization makes litte sense in real world programs, Why this? I do this all the time. I know that they *are* already initialized so why should I do this again? so those warnings have their use. Of what use are

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-10 Thread Jürgen Hestermann
Am 2015-03-09 um 19:24 schrieb DaWorm: I would think this part answers that question: The warning means that no value has been */explicitly/* assigned to these variables (which */may indicate a logic error/* in the code), not necessarily that they contain an unpredictable value. (emphasis

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-10 Thread Jürgen Hestermann
Am 2015-03-10 um 18:16 schrieb Lukasz Sokol: On 10/03/15 16:08, Jürgen Hestermann wrote: Then please tell me, what do you (or anybody else) gain from this warning? Especially, as it claims something that is definitely not true (for managed types). It may even misguide some to add

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-10 Thread Jürgen Hestermann
Am 2015-03-10 um 09:48 schrieb Lukasz Sokol: On 10/03/15 06:10, Jürgen Hestermann wrote: Am 2015-03-09 um 19:24 schrieb DaWorm: I would think this part answers that question: The warning means that no value has been */explicitly/* assigned to these variables (which */may indicate a logic

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-10 Thread Jürgen Hestermann
Am 2015-03-10 um 10:08 schrieb Mattias Gaertner: On Tue, 10 Mar 2015 08:48:49 + Lukasz Sokol el.es...@gmail.com wrote: On 10/03/15 06:10, Jürgen Hestermann wrote: [...] Why not simply omit these messages (for managed types)? Just because YOU don't need it, doesn't mean it's useless

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-09 Thread Jürgen Hestermann
Am 2015-03-09 um 18:31 schrieb Jonas Maebe: On 09 Mar 2015, at 17:49, Jürgen Hestermann juergen.hesterm...@gmx.de wrote: Am 2015-03-09 um 17:40 schrieb Jonas Maebe: http://bugs.freepascal.org/view.php?id=24601#c75617 (and the comment below + use -vq to see warning numbers, and -vm

Re: [fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-09 Thread Jürgen Hestermann
Am 2015-03-09 um 17:40 schrieb Jonas Maebe: On 09 Mar 2015, at 17:25, Jürgen Hestermann wrote: I get a warning that a local dynamic array variable is not initialized. Aren't such managed types initialized by default? On http://wiki.freepascal.org/Dynamic_array it says: Actually, dynamic

[fpc-pascal] Warning Local variable seems to be not initialized on dyn array

2015-03-09 Thread Jürgen Hestermann
I get a warning that a local dynamic array variable is not initialized. Aren't such managed types initialized by default? On http://wiki.freepascal.org/Dynamic_array it says: Actually, dynamic arrays are pointers with automatic dereferencing. They are initialized to *nil* automatically. So why

Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Jürgen Hestermann
Am 2014-10-30 um 15:21 schrieb Michael Van Canneyt: On Thu, 30 Oct 2014, Mattias Gaertner wrote: Under Linux I see UTC. But on Windows it seems to return with timezone. See this bug: http://bugs.freepascal.org/view.php?id=26963 Quite possible: like I said, it depends on the OS. The change to

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-06 Thread Jürgen Hestermann
Am 2014-10-06 um 07:55 schrieb Sven Barth: On 06.10.2014 07:20, Jürgen Hestermann wrote: Am 2014-10-05 um 20:21 schrieb Sven Barth: Please note that GetLastError is Windows-specific. The cross platform function in SysUtils is called GetLastOSError which does return Integer. And why does

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-06 Thread Jürgen Hestermann
Am 2014-10-05 um 15:08 schrieb Michael Van Canneyt: A typecast will be needed somewhere. Yes, instead of assigning the two values as in Integer_Type := DWord_Type; MOVE could be used: move(DWord_Type,Integer_Type,sizeof(DWord_Type)); This way no range check would trigger and no bit would

Re: [fpc-pascal] Syserrormessage, parameter data type

2014-10-05 Thread Jürgen Hestermann
Am 2014-10-05 um 12:10 schrieb Michael Van Canneyt: Not necessarily, because it is a cross-platform function and on other systems the error codes are not necessarily positive values. Unfortunately, this kind of windows-api-creep is found throughout the RTL. The proper procedure is probably to

Re: [fpc-pascal] *** GMX Spamverdacht *** Re: Syserrormessage, parameter data type

2014-10-05 Thread Jürgen Hestermann
Am 2014-10-05 um 19:04 schrieb leledumbo: But the current situation is wrong for *all* plattforms FormatMessage doesn't exist on non-Windows platform. SysErrorMessage doesn't call FormatMessage on Linux for instance. Then it would make even less sense to use INTEGER in SysErrormessage. The

[fpc-pascal] Syserrormessage, parameter data type

2014-10-04 Thread Jürgen Hestermann
In my programs I use this code quite often: SysErrorMessage(GetLastError); But recently my program had a range check error which let me have a look at the definiton of the 2 functions GetLastError and SysErrorMessage. GetLastError is from the WinAPI:

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Jürgen Hestermann
Am 2014-09-13 22:31, schrieb Marius: Mattias Gaertner wrote: All seasoned programmers know that and try to avoid the with statement. Realy? I love it. Consider these two varianst of code from one of my programs: - with

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Jürgen Hestermann
Am 2014-09-14 12:08, schrieb Mattias Gaertner: All seasoned programmers know that and try to avoid the with statement. The quote is from Marius, not from me. Correct. I deleted the wrong reference. ;-( Realy? I love it. Consider these two varianst of code from one of my programs:

Re: [fpc-pascal] why dynamic array created in constructor not automatically free in destructor

2014-08-07 Thread Jürgen Hestermann
Am 2014-08-07 10:21, schrieb Dennis Poon: TMyClass=class public ar : array of integer; constructor Create; destructor destroy;override; end; TMyClass.Create; begin inherited; SetLength(ar, 100); end; TMyClass.Destroy; begin ar := nil;//--- this is needed otherwise a

Re: [fpc-pascal] why dynamic array created in constructor not automatically free in destructor

2014-08-07 Thread Jürgen Hestermann
Am 2014-08-07 11:32, schrieb Michael Van Canneyt: The compiler frees dynamic arrays. Does this happen too if you declare a dynamic array locally in a function and leave this function? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] SetLength procedure

2014-07-27 Thread Jürgen Hestermann
Am 2014-07-27 12:10, schrieb Steve Gatenby: Could anybody enlighten me on how to make the 'SetLength' procedure into an equivalent function I have many instances of SetLength(xxx, Length(xxx)+1); Num := High(xxx); What is the problem with this code? Why force these 2 commands into a

  1   2   3   4   >