ATS has multiple types for strings:

non linear (string, also length-indexed)
linear (strbuf for C-like construction purposes, strptr and length-indexed
strnptr)

If you want to temporarily create a string, and then discard it, you could
use strptr.

There is also a contrib package for ref-counted strings. Makes writing code
that manipulates strings easier to write.

7 окт. 2017 г. 5:56 PM пользователь "Russoul" <[email protected]> написал:

> And how to correctly convert char* to string ? Just
> $UNSAFE.cast{string}(pointer) ? Will the original char* be GCed by ATS ?
>
> суббота, 7 октября 2017 г., 14:33:13 UTC+3 пользователь gmhwxi написал:
>>
>>
>> Assuming that you are targeting C. I would suggest that you use snprintf
>> (plus $UNSAFE.cast).
>>
>> On Saturday, October 7, 2017 at 5:40:01 AM UTC-4, Russoul wrote:
>>>
>>> convert primitives (int,float,...) to string (or linear string). Convert
>>> native char* to string and reversed ?
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ats-lang-users/db92b4d8-58aa-4033-a446-d4f009c0215c%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/ats-lang-users/db92b4d8-58aa-4033-a446-d4f009c0215c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAKO6%3Dqgag8%3Ds92EJh7HaKeJVfy_88j8H2dY%3Dkfx9t66S3Grmkg%40mail.gmail.com.

Reply via email to