Re: [fpc-pascal] Array clearing

2017-04-01 Thread wkitty42
On 04/01/2017 02:33 PM, Jürgen Hestermann wrote: 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

Re: [fpc-pascal] parameter list declaration

2017-04-01 Thread leledumbo via fpc-pascal
> I found this: http://www.freepascal.org/docs-html/ref/refse91.html but I think it's not really clear, especially for newbie Newbies often skip http://www.freepascal.org/docs-html/ref/refli5.html so they can't read the diagrams used in all later sections. > Compare that to official document

Re: [fpc-pascal] Threading vs Parallelism ?

2017-04-01 Thread Michael Schnell
On 31.03.2017 10:18, Tony Whyman wrote: Neither of the above implies multiple CPUs or processing units. Regarding the view of the application (disregarding execution speed) or of the application programmer, there is no difference between real ("Hardware") and virtual (e.g. threads)

Re: [fpc-pascal] Threading vs Parallelism ?

2017-04-01 Thread Ryan Joseph
> On Mar 31, 2017, at 5:32 PM, Michael Schnell wrote: > > Regarding the view of the application (disregarding execution speed) or of > the application programmer, there is no difference between real ("Hardware") > and virtual (e.g. threads) parallelism. These dirty basics

Re: [fpc-pascal] Setting record values

2017-04-01 Thread Ryan Joseph
> On Apr 1, 2017, at 2:46 PM, Sven Barth via fpc-pascal > wrote: > > I haven't looked at it in detail, but it could be that both have similar > efficiency. You could also add "inline" to the MakePoint function which > should get rid of a potential temporary

Re: [fpc-pascal] parameter list declaration

2017-04-01 Thread Michael Van Canneyt
On Sat, 1 Apr 2017, Mr Bee via fpc-pascal wrote: Hi all, I'm looking for official reference for function/procedure parameter list declaration in Pascal. I found this: http://www.freepascal.org/docs-html/ref/refse91.html but I think it's not really clear, especially for newbie. For example,

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 05:42 schrieb "Ryan Joseph" : > > As far as the compiler is concerned what’s the difference between clearing an array using a for-loop vs. FillChar? It seems like iterating the array would be slower but what does FillChar do exactly and is it faster? The

Re: [fpc-pascal] Setting record values

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 05:59 schrieb "Ryan Joseph" : > > I’ve been using a design pattern in my code which I think is probably pretty stupid so I’d like to make sure. Assume I have a type like TPoint below and I want to set the value I’ll doing something like point :=

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Ryan Joseph
> On Apr 1, 2017, at 2:50 PM, Ryan Joseph wrote: > > Yeah, I was concerned with just compiler types or weakly retained classes > where I’m just keeping the reference. Another question. Is it more efficient/faster to reallocate a new array of the same size or call

Re: [fpc-pascal] Threading vs Parallelism ?

2017-04-01 Thread Michael Schnell
On 30.03.2017 18:29, Jon Foster wrote: I say threading is parallelism, even if just one form of it. The other methods of parallelism I mentioned here could also be done in FPC with the appropriate code. Threading is the way parallelism can be achieved using a "standard" programming language

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Ryan Joseph
> On Apr 1, 2017, at 2:39 PM, Sven Barth via fpc-pascal > wrote: > > It totally depends on the type. In case of primitive types like integers > there is indeed only the performance difference (though if you know that the > element size is four FillDWord could

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] Array clearing

2017-04-01 Thread Ryan Joseph
> On Apr 1, 2017, at 6:31 PM, Jürgen Hestermann > wrote: > > 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) ). Because the array

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 Sven Barth via fpc-pascal
Am 01.04.2017 10:35 schrieb "Ryan Joseph" : > > > > On Apr 1, 2017, at 2:50 PM, Ryan Joseph wrote: > > > > Yeah, I was concerned with just compiler types or weakly retained classes where I’m just keeping the reference. > > Another question.

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 13:31 schrieb "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

Re: [fpc-pascal] Threading vs Parallelism ?

2017-04-01 Thread Gary Doades
>> On Mar 31, 2017, at 5:32 PM, Michael Schnell wrote: >> >> Regarding the view of the application (disregarding execution speed) or of >> the application programmer, there is no difference between real ("Hardware") >> and virtual (e.g. threads) parallelism. These dirty

Re: [fpc-pascal] Array clearing

2017-04-01 Thread wkitty42
On 04/01/2017 07:31 AM, Jürgen Hestermann wrote: 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) ). consider this: when using a string var and writing to a binary

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