Hairy Pixels via fpc-pascal schrieb am
Mo., 18. März 2024, 13:30:
>
>
> > On Mar 18, 2024, at 5:29 PM, Michael Van Canneyt via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> >
> > Of course there must be, that's the whole point of copy-on-write.
> >
> > As soon as one reference is chang
On 2024-03-18 13:29, Hairy Pixels via fpc-pascal wrote:
On Mar 18, 2024, at 5:29 PM, Michael Van Canneyt via fpc-pascal
wrote:
Of course there must be, that's the whole point of copy-on-write.
As soon as one reference is changed, a copy is made if the reference
count
is larget than 1, and t
> On Mar 18, 2024, at 5:29 PM, Michael Van Canneyt via fpc-pascal
> wrote:
>
> Of course there must be, that's the whole point of copy-on-write.
>
> As soon as one reference is changed, a copy is made if the reference count
> is larget than 1, and this copy is changed.
Oh, it does copy on wr
On Mon, 18 Mar 2024, Hairy Pixels via fpc-pascal wrote:
On Mar 18, 2024, at 3:27 PM, Hairy Pixels wrote:
Oh, it's a pointer to a pointer? I guess that explains how it can resize itself
and not invalidate shared references, if those are even possible with
AnsiString.
Wait, that's total
Op 18-3-2024 om 09:27 schreef Hairy Pixels via fpc-pascal:
do that, you'll have the same output 3 times.
Oh, it's a pointer to a pointer?
No, it is a pointer variable, but you take the address (@) of that
pointer, which causes the second indirection
_
> On Mar 18, 2024, at 3:27 PM, Hairy Pixels wrote:
>
> Oh, it's a pointer to a pointer? I guess that explains how it can resize
> itself and not invalidate shared references, if those are even possible with
> AnsiString.
Wait, that's totally wrong. :) @s is the address of the local variable
> On Mar 18, 2024, at 1:52 PM, Michael Van Canneyt via fpc-pascal
> wrote:
>
> An ansistring is a pointer to a memory block.
>
> You are printing the address of S1 and the address of S, i.e. the address of
> the pointer itself, not the address of what S (or s1) points to. Obviously
> the add
On Mon, 18 Mar 2024, Hairy Pixels via fpc-pascal wrote:
Curious, why did the address of "s" change here? Shouldn't the AnsiString be
incrementing a reference count and not actually changing the actual pointer or copying?
Correct me if I'm wrong, AnsiString is ref counted when passing in/ou
Curious, why did the address of "s" change here? Shouldn't the AnsiString be
incrementing a reference count and not actually changing the actual pointer or
copying?
Correct me if I'm wrong, AnsiString is ref counted when passing in/out
functions but copies on assignment so technically no two A
(* Program One *)
{$codepage utf8}
{$Mode objfpc}
Uses math,sysutils;
Var cad:ansistring;
c,n:longword;
Begin
c:=2**30; // 1 GiB
n:=4; // with 3 & 4 at fpc 2.4.2, no show Out of Memory
// with 3 & 4 at fpc 2.5.1, no show Out of Memory
(02/11/2011 04:04p.m.
Luis Fernando Del Aguila Mejía schrieb:
> p:=pointer(cad1);
> p:=p-8;
> Write('memory address : ',longint(p),'='); //Must show Size, but
shows reference count
> Writeln(longint(p^));
I fail to see why you need to mess with the internals of ansistrings at all.
What is the reason to access
Luis Fernando Del Aguila Mejía wrote:
> The documentation
> (http://www.freepascal.org/docs-html/prog/progsu146.html#x189-1990008.2.7)
> says:
> -8 Longint current string with size.
> -4 Longint with reference count.
> But, when I want access to that structure, I have to do it backwards.
The documentation
(http://www.freepascal.org/docs-html/prog/progsu146.html#x189-1990008.2.7)
says:
-8 Longint current string with size.
-4 Longint with reference count.
But, when I want access to that structure, I have to do it backwards.
-8 Longint with reference count.
-4 Longint cur
Graeme Geldenhuys wrote:
On Mon, Sep 29, 2008 at 11:19 AM, Brad Campbell <[EMAIL PROTECTED]> wrote:
I'm chasing an issue with a program I have that is leaving an Ansistring
unfreed on exit. It exists cleanly without using halt(), but this is the the
only way I've managed to reproduce it.
Should
On Mon, Sep 29, 2008 at 11:19 AM, Brad Campbell <[EMAIL PROTECTED]> wrote:
> I'm chasing an issue with a program I have that is leaving an Ansistring
> unfreed on exit. It exists cleanly without using halt(), but this is the the
> only way I've managed to reproduce it.
>
> Should Halt() leave memor
I'm chasing an issue with a program I have that is leaving an Ansistring unfreed on exit. It exists
cleanly without using halt(), but this is the the only way I've managed to reproduce it.
Should Halt() leave memory unfreed?
It is only reproducible if I use ExtractFileName or ExtractFileExt.. (
Hello,
> How can I use fillchar to give an ansistring a value of, say
> 'x'? In other words, I want to create a string that contains
> only a single character, that is repeated a certain number of times.
E.g. this should work (with some typecasting ;-):
{$MODE DELPHI}
var
s : AnsiSt
On Tue, 9 Dec 2003, Mark Emerson wrote:
> How can I use fillchar to give an ansistring a value of, say
> 'x'? In other words, I want to create a string that contains
> only a single character, that is repeated a certain number of times.
Use
S:=StringOfChar('X',30);
Michael.
Hello Mark
>
> How can I use fillchar to give an ansistring a value of, say
> 'x'? In other words, I want to create a string that contains
> only a single character, that is repeated a certain number of times.
>
> Mark
>
There is an example in the reference guide for function FillC
How can I use fillchar to give an ansistring a value of, say
'x'? In other words, I want to create a string that contains
only a single character, that is repeated a certain number of times.
Mark
___
fpc-pascal maillist - [EMAIL PROTECTED]
20 matches
Mail list logo