1. string pointer

------=_NextPart_000_0013_01BFEB2E.AA1CCB60
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

does allocate_string("string") copy string or does it just return =
pointer to sequence and is because of that fast?


------=_NextPart_000_0013_01BFEB2E.AA1CCB60
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>does allocate_string("string") copy =
string or does=20
it just return pointer to sequence and is because of that =
fast?</FONT></DIV>

------=_NextPart_000_0013_01BFEB2E.AA1CCB60--

new topic     » topic index » view message » categorize

2. Re: string pointer

Hello ©koda,

>does allocate_string("string") copy string or does it just return pointer
>to sequence and is because of that fast?

It returns a memory address of the first character in memory ('s').
It DOES "copy" the string and poke it to memory I think but if you
pass it a literal (like your example) the original sequence is
freed from memory as soon as allocate_string () returns.

Lewis Townsend
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: string pointer

allocate_string("string") allocates the number of bytes in "string"+1(the
extra byte is for a NULL character which terminates most, if not all,
strings) and pokes it into the resulting pointer, which it returns to you.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu