hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit fa019f19dde73b783173d54078f9c981754f2cf9
parent 2592c0858873bae68aecbf64d165adcbf95d06bc
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 30 Jan 2021 15:55:07 -0500

strings: improve cstrings documentation

Diffstat:
Mstrings/cstrings.ha | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/strings/cstrings.ha b/strings/cstrings.ha @@ -1,3 +1,5 @@ +// Computes the length of a NUL-terminated C string, in octets, in O(n). The +// computed length not include the NUL terminator in the length. export fn c_strlen(cstr: *const char) size = { const ptr = cstr: *[*]u8; let ln = 0z; @@ -5,7 +7,7 @@ export fn c_strlen(cstr: *const char) size = { return ln; }; -// Wraps a C string in the appropriate Hare structures +// Converts a C string to a Hare string in O(n). export fn from_c(cstr: *const char) const str = { const l = c_strlen(cstr); const s = struct { // TODO: Use types::string