Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
This has been sent to the wrong address, sorry Michael. Am 28.02.2012 08:57, schrieb Michael Schnell: Often we need to combine buffer data from binary pieces and character data/strings. Obviously. So why not define decent types like ByteString, WordString, DWordString, (maybe CharString,

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 05:04, schrieb Martin Schreiber: Hi, I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. With AnsiString we used setlength() in order to allocate not initialized memory. TBytes is defined

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 08:24, schrieb Martin Schreiber: This has been sent to the wrong address, sorry Michael. So I'm not the only one who often has this problem when answering to one of Michael's mails ^^ (suggested solution answer to all or equivalent solution for your client) Regards, Sven

Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
Am 28.02.2012 09:23, schrieb Sven Barth: For strings SetLength also fills the string with zeros as the following example shows: === example begin === program setlengthtest; var barr: array of Byte; b: Byte; s: AnsiString; c: Char; begin SetLength(barr, 20); for b in barr do Write(b, ' ');

Re: [fpc-devel] TBytes

2012-02-28 Thread Mattias Gaertner
On Tue, 28 Feb 2012 09:23:34 +0100 Sven Barth pascaldra...@googlemail.com wrote: Am 28.02.2012 05:04, schrieb Martin Schreiber: Hi, I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. With

Re: [fpc-devel] TBytes

2012-02-28 Thread Michael Schnell
On 02/28/2012 09:34 AM, Sven Barth wrote: So I'm not the only one who often has this problem when answering to one of Michael's mails Ooops. Why are my contributions different from others ? I am just using Thunderbird and do answer to all when replying to the list (as the list daemons

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 08:40, schrieb Martin Schreiber: Am 28.02.2012 09:23, schrieb Sven Barth: For strings SetLength also fills the string with zeros as the following example shows: === example begin === program setlengthtest; var barr: array of Byte; b: Byte; s: AnsiString; c: Char; begin

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 09:41, schrieb Michael Schnell: On 02/28/2012 09:34 AM, Sven Barth wrote: So I'm not the only one who often has this problem when answering to one of Michael's mails Ooops. Why are my contributions different from others ? I am just using Thunderbird and do answer to all when

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 09:41, schrieb Mattias Gaertner: On Tue, 28 Feb 2012 09:23:34 +0100 Sven Barthpascaldra...@googlemail.com wrote: Am 28.02.2012 05:04, schrieb Martin Schreiber: Hi, I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers

Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
Am 28.02.2012 09:46, schrieb Sven Barth: You are right, I checked the code of SetLength for arrays and strings and only arrays use FillChar. Nevertheless there is no other operation you can use for arrays. Same in Delphi? Martin ___ fpc-devel

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 09:07, schrieb Martin Schreiber: Am 28.02.2012 09:46, schrieb Sven Barth: You are right, I checked the code of SetLength for arrays and strings and only arrays use FillChar. Nevertheless there is no other operation you can use for arrays. Same in Delphi? I can't tell whether

Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
Am 28.02.2012 10:10, schrieb Sven Barth: Am 28.02.2012 09:07, schrieb Martin Schreiber: Am 28.02.2012 09:46, schrieb Sven Barth: You are right, I checked the code of SetLength for arrays and strings and only arrays use FillChar. Nevertheless there is no other operation you can use for

Re: [fpc-devel] TBytes

2012-02-28 Thread Marco van de Voort
In our previous episode, Martin Schreiber said: I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. With AnsiString we used setlength() in order to allocate not initialized memory. TBytes is

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 10:40, schrieb Michael Schnell: On 02/28/2012 09:52 AM, Sven Barth wrote: Maybe you should do an answer to list yourself? At least the FPC and Lazarus list daemons seem to be configured properly... So you think the additional mail to the original poster is not appropriate. If

Re: [fpc-devel] TBytes

2012-02-28 Thread Michael Schnell
On 02/28/2012 10:43 AM, Sven Barth wrote: Let's make a test: Answer to this mail once using answer all and once answer list. Then I will answer to you using answer list and we'll see where the answers go. This is the reply all test message for Sven. Those who are not concerned: please ignore.

Re: [fpc-devel] TBytes

2012-02-28 Thread Michael Schnell
On 02/28/2012 10:43 AM, Sven Barth wrote: Let's make a test: Answer to this mail once using answer all and once answer list. Then I will answer to you using answer list and we'll see where the answers go. This is the reply to sender test message for Sven. (_Here_ in fact it goes to the list.

Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
Am 28.02.2012 10:38, schrieb Marco van de Voort: In our previous episode, Martin Schreiber said: I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. With AnsiString we used setlength() in order to

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 09:28, schrieb Martin Schreiber: Am 28.02.2012 10:10, schrieb Sven Barth: Am 28.02.2012 09:07, schrieb Martin Schreiber: Am 28.02.2012 09:46, schrieb Sven Barth: You are right, I checked the code of SetLength for arrays and strings and only arrays use FillChar. Nevertheless

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 10:47, schrieb Michael Schnell: On 02/28/2012 10:43 AM, Sven Barth wrote: Let's make a test: Answer to this mail once using answer all and once answer list. Then I will answer to you using answer list and we'll see where the answers go. This is the reply to sender test message

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 10:52, schrieb Sven Barth: Am 28.02.2012 10:47, schrieb Michael Schnell: On 02/28/2012 10:43 AM, Sven Barth wrote: Let's make a test: Answer to this mail once using answer all and once answer list. Then I will answer to you using answer list and we'll see where the answers go.

Re: [fpc-devel] TBytes

2012-02-28 Thread Michael Schnell
On 02/28/2012 10:52 AM, Sven Barth wrote: Am 28.02.2012 10:47, schrieb Michael Schnell: On 02/28/2012 10:43 AM, Sven Barth wrote: Let's make a test: Answer to this mail once using answer all and once answer list. Then I will answer to you using answer list and we'll see where the answers go.

Re: [fpc-devel] TBytes

2012-02-28 Thread Michael Schnell
On 02/28/2012 10:54 AM, Sven Barth wrote: So it seems that you should use reply to sender as this was the only mail that went to the list with reply to list... Now it would be interesting to know why this is the case ^^ Seemingly the list daemons can be configured regarding what to use as

Re: [fpc-devel] TBytes

2012-02-28 Thread Marco van de Voort
In our previous episode, Martin Schreiber said: If you care, you can do manual management. Yup, MSEgui has allocuninitedarray() for the purpose. I don't think it is more clean or secure than the old ansistring method because it depends on compiler internals. getmem/freemem ? Or pool

Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
Am 28.02.2012 11:59, schrieb Marco van de Voort: In our previous episode, Martin Schreiber said: If you care, you can do manual management. Yup, MSEgui has allocuninitedarray() for the purpose. I don't think it is more clean or secure than the old ansistring method because it depends on

Re: [fpc-devel] TBytes

2012-02-28 Thread Marco van de Voort
In our previous episode, Martin Schreiber said: think that is still bad though, but if you switch typing string to explicit ansistring, there is no rush), but I think at least public programming interfaces should be free of such gotchas. [...] Then please implement such a handy

Re: [fpc-devel] TBytes

2012-02-28 Thread Martin Schreiber
Am 28.02.2012 12:18, schrieb Marco van de Voort: In our previous episode, Martin Schreiber said: think that is still bad though, but if you switch typing string to explicit ansistring, there is no rush), but I think at least public programming interfaces should be free of such gotchas. [...]

Re: [fpc-devel] TBytes

2012-02-28 Thread Michael Schnell
On 02/28/2012 11:14 AM, Martin Schreiber wrote: Then please implement such a handy character string compatible automatic memory managed buffer type. For alternative Data-String type we of course would need things like TStringlist, as well ! -Michael

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 12:18, schrieb Marco van de Voort: This was about a case where it was not character data. And please don't wait until Delphi has made it or Delphi changed string handling completely again which seems to be possible according a thread with Allen Bauer in Embarcadero forum. And

Re: [fpc-devel] TBytes

2012-02-28 Thread Marco van de Voort
In our previous episode, Sven Barth said: handling completely again which seems to be possible according a thread with Allen Bauer in Embarcadero forum. And please implement it before AnsiStrings can't be used for the purpose anymore. If you care about the repeated addition stuff, you

Re: [fpc-devel] TBytes

2012-02-28 Thread Sergei Gorelkin
28.02.2012 16:31, Marco van de Voort пишет: In our previous episode, Sven Barth said: handling completely again which seems to be possible according a thread with Allen Bauer in Embarcadero forum. And please implement it before AnsiStrings can't be used for the purpose anymore. If you care

Re: [fpc-devel] TBytes

2012-02-28 Thread Sven Barth
Am 28.02.2012 13:31, schrieb Marco van de Voort: In our previous episode, Sven Barth said: handling completely again which seems to be possible according a thread with Allen Bauer in Embarcadero forum. And please implement it before AnsiStrings can't be used for the purpose anymore. If you

[fpc-devel] TBytes

2012-02-27 Thread Martin Schreiber
Hi, I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. With AnsiString we used setlength() in order to allocate not initialized memory. TBytes is defined as TBytes = array of Byte; where

Re: [fpc-devel] TBytes

2012-02-27 Thread Michael Schnell
On 02/28/2012 05:04 AM, Martin Schreiber wrote: I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. Why ? To me (Ansi-) strings seem a lot more convenient in many cases (e.g. when implementing a

Re: [fpc-devel] TBytes

2012-02-27 Thread Martin Schreiber
Am 28.02.2012 08:06, schrieb Michael Schnell: On 02/28/2012 05:04 AM, Martin Schreiber wrote: I read that we should use TBytes instead of AnsiString in order to implement combined binary/character buffers with automatic memory management. Why ? Because of Delphi compatibility and code

Re: [fpc-devel] TBytes

2012-02-27 Thread Michael Schnell
On 02/28/2012 07:29 AM, Martin Schreiber wrote: Because of Delphi compatibility and code cleanness. I see: The Unicode Threat that makes String a moving target, forcing the poor String type to be visible Text i.e. holding a (somehow) known encoding of its binary content. Of course I do see