On 2 Jun 2010, at 20:09, spir wrote:
>> http://wiki.freepascal.org/for-in_loop
>
> Is this implemented? (unable to make it work -- the compiler refuses the
> for...in notation)
AFAIK, yes. At least, I know it's already in trunk since a while ago. Never use
it myself though.
-Bee-
__
On Wed, 2 Jun 2010 14:30:15 +0200
Graeme Geldenhuys wrote:
> On 2 June 2010 14:16, Marco van de Voort wrote:
> >
> > Afaik it is merged into 2.4.1 already.
>
>
> Did somebody actually test it other than Paul (that also implemented
> it)? If so, that was a rather quick test for a big compiler c
On Wed, 2 Jun 2010 15:19:55 +0700
Bee Jay wrote:
> On 1 Jun 2010, at 22:13, spir ☣ wrote:
>
> > (*) And to some more constructs in other languages, like foreach (*the*
> > feature I miss in freepascal):
> > foreach name in names do ... end;
>
> http://wiki.freepascal.org/for-in_loop
Is this
On Wed, 2 Jun 2010, Marco van de Voort wrote:
In our previous episode, Michael Van Canneyt said:
http://wiki.freepascal.org/for-in_loop
-Bee-
Great! Thank you very much. (Is this feature mentionned in "official" docs? how could I
miss it? The ref guide only mentions "The For..to/downto..
On 2 June 2010 14:16, Marco van de Voort wrote:
>
> Afaik it is merged into 2.4.1 already.
Did somebody actually test it other than Paul (that also implemented
it)? If so, that was a rather quick test for a big compiler change.
--
Regards,
- Graeme -
__
In our previous episode, Michael Van Canneyt said:
> >>
> >> http://wiki.freepascal.org/for-in_loop
> >>
> >> -Bee-
> >
> > Great! Thank you very much. (Is this feature mentionned in "official" docs?
> > how could I miss it? The ref guide only mentions "The For..to/downto..do
> > statement", I gu
On Wed, 2 Jun 2010, spir wrote:
On Wed, 2 Jun 2010 15:19:55 +0700
Bee Jay wrote:
On 1 Jun 2010, at 22:13, spir ☣ wrote:
(*) And to some more constructs in other languages, like foreach (*the* feature
I miss in freepascal):
foreach name in names do ... end;
http://wiki.freepascal.org/
On 2 June 2010 12:39, spir wrote:
>
> Great! Thank you very much. (Is this feature mentionned in "official" docs?
> how could I miss it? The ref guide only mentions "The For..to/downto..do
> statement", I guess.)
>
I don't think it's in FPC 2.4.1 either, only Trunk (2.5.1) - so no,
the current
On Wed, 2 Jun 2010 15:19:55 +0700
Bee Jay wrote:
> On 1 Jun 2010, at 22:13, spir ☣ wrote:
>
> > (*) And to some more constructs in other languages, like foreach (*the*
> > feature I miss in freepascal):
> > foreach name in names do ... end;
>
> http://wiki.freepascal.org/for-in_loop
>
> -Be
On 1 Jun 2010, at 22:13, spir ☣ wrote:
> (*) And to some more constructs in other languages, like foreach (*the*
> feature I miss in freepascal):
> foreach name in names do ... end;
http://wiki.freepascal.org/for-in_loop
-Bee-
___
fpc-pascal mailli
> > >> This is not correct. Many strings are simply referenced several
> > >> times.
> > >
> > > May I ask in which typical cases?
In an earlier version of our database (before we had things properly typed)
many
things were stored as strings. Thus a common ansistring may have had a
reference
On Tue, 01 Jun 2010 16:30:22 +0100
Martin wrote:
> I don't know all the internals of FPC, but yes to my understanding, your
> quote:
>"parameter passing is just an implicit assignment"
> is absolutely true.
>
> So why do you then say "copy on write" would not apply?
> The assignment creates
On 01/06/2010 16:13, spir ☣ wrote:
On Tue, 01 Jun 2010 15:00:47 +0100
Martin wrote:
On 01/06/2010 11:23, spir ☣ wrote:
What is the actual benefit of copy-on-write? I ask because of the following
reasoning:
* If a string is just used at several places, for example in output or into
On Tue, 1 Jun 2010 14:36:36 +0200
Jonas Maebe wrote:
>
> On 01 Jun 2010, at 14:28, spir ☣ wrote:
>
> > On Tue, 1 Jun 2010 13:05:16 +0200 (CEST)
> > Michael Van Canneyt wrote:
> >
> >> This is not correct. Many strings are simply referenced several
> >> times.
> >
> > May I ask in which typic
On Tue, 01 Jun 2010 15:00:47 +0100
Martin wrote:
> On 01/06/2010 11:23, spir ☣ wrote:
> > What is the actual benefit of copy-on-write? I ask because of the following
> > reasoning:
> > * If a string is just used at several places, for example in output or into
> > bigger strings, then there is
On 01/06/2010 11:23, spir ☣ wrote:
What is the actual benefit of copy-on-write? I ask because of the following
reasoning:
* If a string is just used at several places, for example in output or into
bigger strings, then there is no reason reason to copy it into a new variable.
* If a programmer
On 01 Jun 2010, at 14:28, spir ☣ wrote:
On Tue, 1 Jun 2010 13:05:16 +0200 (CEST)
Michael Van Canneyt wrote:
This is not correct. Many strings are simply referenced several
times.
May I ask in which typical cases?
The most common one is probably assigning a function result to a
variabl
On Tue, 1 Jun 2010 13:05:16 +0200 (CEST)
Michael Van Canneyt wrote:
[...]
Thank you for all answers (all is now clear for me :-).
> > * If a programmer explicitely assigns an existing string to a new variable,
> > the intent is precisely copy-semantics, to make them independent for
> > furthe
On Tue, 1 Jun 2010, spir ☣ wrote:
Hello,
The documentation in the ref manual about PChar may have i bit more details:
http://www.freepascal.org/docs-html/ref/refsu13.html#x36-390003.2.7
Do the following statements hold true?
* This type is mainly intended to interface with C code (or for l
2010/6/1 spir ☣ :
> * Like C strings, and unlike AnsiString-s (even if the latter also are
> "pointed")
Sure if you cast an AnsiString to a PChar it will only go until the
first #0. You can't magically add capabilities to the PChar type.
> * How is length computed (traversal?)?
It isn't compute
Hello,
The documentation in the ref manual about PChar may have i bit more details:
http://www.freepascal.org/docs-html/ref/refsu13.html#x36-390003.2.7
Do the following statements hold true?
* This type is mainly intended to interface with C code (or for low-level
needs?). Else AnsiString shou
On 29/10/2009, Marco van de Voort wrote:
>
>
> No, probably mixed sysutils and strings(?) use. pstring is defined in both
> TP and Delphi. Once to short, once to ansistring
That that must be FPC that is getting confused. In Lazurus I when
"Project > New > Free Pascal application". That's as bas
In our previous episode, Henry Vermaak said:
> >
> > Trying what you suggested, I get the following compiler error.
> >
> > project1.lpr(20,11) Error: Incompatible types: got "PString" expected
> > "PChar"
>
> This is probably dependant on compiler modes?
No, probably mixed sysutils and strings(
2009/10/29 Mattias Gaertner :
>
> I hope you mean {$mode objfpc}{$H+}
:-) Yes.
--
Regards,
- Graeme -
___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pasc
On Thu, 29 Oct 2009 16:42:23 +0200
Graeme Geldenhuys wrote:
> 2009/10/29 Mattias Gaertner :
> >
> > It compiles here. Probably you use some special units.
>
> Weird... As I mentioned, I'm using FPC 2.3.1 (64bit) under Linux and
> $mode objfpc.
I hope you mean {$mode objfpc}{$H+}
Mattias
2009/10/29 Mattias Gaertner :
>
> It compiles here. Probably you use some special units.
Weird... As I mentioned, I'm using FPC 2.3.1 (64bit) under Linux and
$mode objfpc.
>
> Graeme, why don't you just change the type of 'Text' to string?
That's the plan - eventually. But the code is large and
2009/10/29 Henry Vermaak :
>
> This is probably dependant on compiler modes?
I'm using: $mode objfpc
> You may have to do it like this:
>
> StrDispose(Text);
> Text := StrAlloc(length(s) + 1);
> StrPCopy(Text, s);
Ah, now it works plus no memory leaks.
Thanks! :-)
Wow, something as simple as
2009/10/29 Graeme Geldenhuys :
> On 29/10/2009, Mattias Gaertner wrote:
>>
>>
>> Text:=strnew(PChar(s));
>
> You read my mind. I was going to ask if it's ok to cast a PString to a PChar.
>
> Trying what you suggested, I get the following compiler error.
>
> project1.lpr(20,11) Error: Incompatible
On Thu, 29 Oct 2009 15:44:09 +0200
Graeme Geldenhuys wrote:
> On 29/10/2009, Mattias Gaertner wrote:
> >
> >
> > Text:=strnew(PChar(s));
>
> You read my mind. I was going to ask if it's ok to cast a PString to
> a PChar.
Yes.
But it will not change the reference count.
> Trying what you sugg
On 29/10/2009, Mattias Gaertner wrote:
>
>
> Text:=strnew(PChar(s));
You read my mind. I was going to ask if it's ok to cast a PString to a PChar.
Trying what you suggested, I get the following compiler error.
project1.lpr(20,11) Error: Incompatible types: got "PString" expected "PChar"
Changi
On Thu, 29 Oct 2009 13:20:42 +
Henry Vermaak wrote:
> 2009/10/29 Mattias Gaertner :
> > On Thu, 29 Oct 2009 15:00:53 +0200
> > Graeme Geldenhuys wrote:
> >
> >> Hi,
> >>
> >> Do I create a memory leak if I cast a PChar it a AnsiString. Then
> >> append text to the AnsiString and then cast it
2009/10/29 Mattias Gaertner :
> On Thu, 29 Oct 2009 15:00:53 +0200
> Graeme Geldenhuys wrote:
>
>> Hi,
>>
>> Do I create a memory leak if I cast a PChar it a AnsiString. Then
>> append text to the AnsiString and then cast it back to the original
>> PChar?
>>
>> eg:
>> var
>> Text: Pchar; <--
On Thu, 29 Oct 2009 15:00:53 +0200
Graeme Geldenhuys wrote:
> Hi,
>
> Do I create a memory leak if I cast a PChar it a AnsiString. Then
> append text to the AnsiString and then cast it back to the original
> PChar?
>
> eg:
> var
> Text: Pchar;<-- global var containing text.
>
> procedure
2009/10/29 Graeme Geldenhuys :
> Hi,
>
> Do I create a memory leak if I cast a PChar it a AnsiString. Then
> append text to the AnsiString and then cast it back to the original
> PChar?
>
> eg:
> var
> Text: Pchar; <-- global var containing text.
>
> procedure AppendText(const AText: string);
>
On Thursday 29 October 2009 14:00:53 Graeme Geldenhuys wrote:
> Hi,
>
> Do I create a memory leak if I cast a PChar it a AnsiString. Then
> append text to the AnsiString and then cast it back to the original
> PChar?
>
> eg:
> var
> Text: Pchar;<-- global var containing text.
>
> procedure Ap
Graeme Geldenhuys wrote:
Hi,
Do I create a memory leak if I cast a PChar it a AnsiString. Then
append text to the AnsiString and then cast it back to the original
PChar?
eg:
var
Text: Pchar;<-- global var containing text.
procedure AppendText(const AText: string);
var
s: string;
begin
On Thu, 29 Oct 2009 15:00:53 +0200
Graeme Geldenhuys wrote:
> Hi,
>
> Do I create a memory leak if I cast a PChar it a AnsiString. Then
> append text to the AnsiString and then cast it back to the original
> PChar?
>
> eg:
> var
> Text: Pchar;<-- global var containing text.
>
> procedure
On Thu, Oct 29, 2009 at 14:00, Graeme Geldenhuys
wrote:
> Hi,
>
> Do I create a memory leak if I cast a PChar it a AnsiString. Then
> append text to the AnsiString and then cast it back to the original
> PChar?
>
> eg:
> var
> Text: Pchar; <-- global var containing text.
>
> procedure AppendTe
Hi,
Do I create a memory leak if I cast a PChar it a AnsiString. Then
append text to the AnsiString and then cast it back to the original
PChar?
eg:
var
Text: Pchar;<-- global var containing text.
procedure AppendText(const AText: string);
var
s: string;
begin
s := Text + AText;
Text
39 matches
Mail list logo