Re: [fpc-pascal] code optimization

2010-09-22 Thread Adrian Veith
Hi Stefan, is this a benchmark program or a complex program you are talking about. If it is a benchmark, then it would be interesting to see the code, because from my experience I doubt that Delphi produces better code than fpc (in general it is the other way round). If it is a complex program,

Re: [fpc-pascal] code optimization

2010-09-22 Thread luca_manganelli
fpc-pascal-boun...@lists.freepascal.org scritti il 22/09/2010 08.08.45 is this a benchmark program or a complex program you are talking about. If it is a benchmark, then it would be interesting to see the code, because from my experience I doubt that Delphi produces better code than fpc (in

[fpc-pascal] Questions regarding arrays

2010-09-22 Thread Graeme Geldenhuys
Hi, I'm have some tough times with arrays (I use them very little). With trial and error I found that to use a pointer to an array of int32 values returned by a C API (Xlib to be exact), I have to define it as follows in Object Pascal. type TAtomArray = array[0..0] of TAtom; PAtomArray =

Re: [fpc-pascal] Questions regarding arrays

2010-09-22 Thread Honza
2010/9/22 Graeme Geldenhuys graemeg.li...@gmail.com: type  TAtomArray = array[0..0] of TAtom;  PAtomArray = ^TAtomArray; Now if I change TAtomArray to the follow, then my code doesn't work. :-)  TAtomArray = array of TAtom;   // a dynamic array So what exactly is the difference between

[fpc-pascal] Re: Questions regarding arrays

2010-09-22 Thread leledumbo
unsigned char **prop_return you can actually define it as: type PAtom = ^TAtom; PPAtom = ^PAtom; and pass a PPAtom variable instead. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Questions-regarding-arrays-tp2849398p2849462.html Sent from the Free

[fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Graeme Geldenhuys
Hi, While implementing drag-n-drop support in fpGUI, I created a TfpgMimeData class. This class will hold various data items, and a mime-type describing each of the data items. Obviously the TfpgMimeData class should be able to handle any data type. So my question is, what is a good universal

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Felipe Monteiro de Carvalho
Personally, I would go for TMemoryStream -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: While implementing drag-n-drop support in fpGUI, I created a TfpgMimeData class. This class will hold various data items, and a mime-type describing each of the data items. Obviously the TfpgMimeData class should be able to handle any data type.

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Michael Van Canneyt
On Wed, 22 Sep 2010, Felipe Monteiro de Carvalho wrote: Personally, I would go for TMemoryStream That would be my option too. It's the most flexible. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Graeme Geldenhuys
On 22 September 2010 12:52, Marco van de Voort wrote: Different choices. The question is if you want some typing (if only runtime) and easy conversions, or e.g. have the data in a directly writable format. Well, the data needs to be passed via Clipboard or Drag-n-Drop API's of the underlying

[fpc-pascal] TEventLog.FileName : Hot to do an append to existing log file

2010-09-22 Thread phoebus phoebus
Hi, I'm not understand how to use unit Teventlog to no create each time a new file but to append to an existing log file. I want to do something like:   assign(f,filename);   if FileExists(filename) then Append(f)   else Rewrite(f);  

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: I would first try a variant. Just for getting the initial DND support to work under Xlib, I limited myself to text types only, so choose variant as my storage type, but now that I'm moving to the next phase (multiple data types), I am

Re: [fpc-pascal] TEventLog.FileName : Hot to do an append to existing log file

2010-09-22 Thread Michael Van Canneyt
On Wed, 22 Sep 2010, phoebus phoebus wrote: Hi, I'm not understand how to use unit Teventlog to no create each time a new file but to append to an existing log file. I want to do something like:   assign(f,filename);   if FileExists(filename) then Append(f)   else

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Michael Van Canneyt
On Wed, 22 Sep 2010, Marco van de Voort wrote: In our previous episode, Graeme Geldenhuys said: I would first try a variant. Just for getting the initial DND support to work under Xlib, I limited myself to text types only, so choose variant as my storage type, but now that I'm moving to

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Graeme Geldenhuys
On 22 September 2010 13:31, Marco van de Voort wrote: No. But it allows you to keep text as text, not as streamed value. I'll see how it goes, maybe I could store text as text, and binary as binary - this will allow for the least amount of conversions. Plus the storage variable not being used

Re : [fpc-pascal] TEventLog.FileName : Hot to do an append to existing log file

2010-09-22 Thread phoebus phoebus
Hi, This is currently not possible. Please file a feature request in the bugtracker. I raised into bugtracker the id: 0017464 for this feature. Regards, Phoebus  ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] Mantis for fpcprojects

2010-09-22 Thread Darius Blaszyk
Can someone from the core team advise how to handle bug reports/ feature requests for fpcprojects? Darius Sorry, forgot to ask - to what category should I submit bugs for fpprofiler? I can't find anything mentioning fpprofiler in http://bugs.freepascal.org ... Can't tell. Can anyone

Re: [fpc-pascal] Any recommendations for a good in-memory storage type

2010-09-22 Thread Matt Emson
Graeme Geldenhuys wrote: So which one would be more fitting for any mime types, or is there another option I didn't think of? Here is a simple usage example of the TfpgMimeData class - to help put this in perspective: This seems a lot like the BMessage class used with in the BeAPI. There

Re: [fpc-pascal] code optimization

2010-09-22 Thread stefan077
Hi Adrian, it is a scientific application that I have, which has about 2000 lines of code. By extracting the most time consuming routine I now have 360 lines of code. With this code I get the following runtime results: optimized FPC pascal *** is 58% SLOWER *** than optimized DELPHI 7

Re: [fpc-pascal] code optimization

2010-09-22 Thread Jonas Maebe
On 22 Sep 2010, at 16:08, stefan...@web.de wrote: Thus it looks like FPC pascal is doing very bad on optimizing the code. I agree, that I also have seen examples where FPC pascal code is about 10% faster than Delphi code. So why does FPC pascal fail on this code? At first sight it looks

Re: [fpc-pascal] Mantis for fpcprojects

2010-09-22 Thread Michael Van Canneyt
On Wed, 22 Sep 2010, Darius Blaszyk wrote: Can someone from the core team advise how to handle bug reports/ feature requests for fpcprojects? I created a new project fpcprojects, with subproject fpprofiler. You are listed as 'developer' for fpprofiler, that should be enough ? Michael.

Re: [fpc-pascal] Mantis for fpcprojects

2010-09-22 Thread Darius Blaszyk
On Wed, 2010-09-22 at 17:29 +0200, Michael Van Canneyt wrote: I created a new project fpcprojects, with subproject fpprofiler. You are listed as 'developer' for fpprofiler, that should be enough ? It's all I wanted ;) Thank you. ___ fpc-pascal

Re: [fpc-pascal] Questions regarding arrays

2010-09-22 Thread Michael Müller
Hi Graeme! Am 22.09.2010 um 11:25 schrieb Graeme Geldenhuys: Hi, I'm have some tough times with arrays (I use them very little). With trial and error I found that to use a pointer to an array of int32 values returned by a C API (Xlib to be exact), I have to define it as follows in Object

Re: [fpc-pascal] Questions regarding arrays

2010-09-22 Thread Reimar Grabowski
On Thu, 23 Sep 2010 00:49:29 +0200 Michael Müller mueller_mich...@alice-dsl.net wrote: Another problem is often to free memory in Pascal that was allocated by C. Having done some interaction with C libs IMHO the best option is not to free the memory in pascal at all but doing it with the