|
|
Log in / Subscribe / Register

DeVault: Announcing the Hare programming language

DeVault: Announcing the Hare programming language

Posted May 2, 2022 16:22 UTC (Mon) by ddevault (subscriber, #99589)
In reply to: DeVault: Announcing the Hare programming language by wtarreau
Parent article: DeVault: Announcing the Hare programming language

>I.e. if I want to write a variant of base64 output whose max output size I already know based on the input, am I supposed to use concat() between strings for every character or may I just create a string of suitable size and fill the chars a-la "*(p++) = c" since I know what I'm doing?

Here's some sample code that might answer your question:

https://paste.sr.ht/~sircmpwn/ba2f1f110c6d3e0a6e16c496af0...

Try changing the buffer size to 16 and run it again - the runtime will detect the overflow and abort.


to post comments

DeVault: Announcing the Hare programming language

Posted May 2, 2022 16:26 UTC (Mon) by wtarreau (subscriber, #51152) [Link] (2 responses)

But this one seems to be using a pre-existing base64() function, my question was rather from the function's implementer point of view. In fact, do I still have the ability to fill a buffer one byte at a time and cast it in return saying "this is my string" (possibly with a required size prefix or any such thing to accommodate for internal needs) ?

DeVault: Announcing the Hare programming language

Posted May 2, 2022 16:31 UTC (Mon) by ddevault (subscriber, #99589) [Link] (1 responses)

I'm still not sure how to answer your question generally, but:

>In fact, do I still have the ability to fill a buffer one byte at a time and cast it in return saying "this is my string"

https://paste.sr.ht/~sircmpwn/7ce10cda33c51304974b324e3b6...

Does that tell you what you want to know?

DeVault: Announcing the Hare programming language

Posted May 2, 2022 16:33 UTC (Mon) by wtarreau (subscriber, #51152) [Link]

> https://paste.sr.ht/~sircmpwn/7ce10cda33c51304974b324e3b6...
>
> Does that tell you what you want to know?

Looks so, thank you :-)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds