I don't understand betterC

evilrat evilrat666 at gmail.com
Mon Sep 4 08:30:10 UTC 2023


On Monday, 4 September 2023 at 07:39:21 UTC, confused wrote:
>
> So then I guess I'd still like to know how I'm expected to 
> store and access an array of characters without the C runtime 
> as I tried in my original post.

Without C runtime functions such as malloc you can still have 
fixed-length arrays, for string variables the compiler will emit 
null-terminated string at compile time in cases like that making 
it compatible with C functions.

Note that it not the case for other string operations like concat 
operator (is it available in betterC?), in that case if you want 
to pass the resulting string you have to add null terminator by 
hand.

If you need to allocate memory at runtime and still wan't to 
avoid C runtime, well I guess you have to do some syscalls then...
Or use another allocator library, jmalloc maybe? Though I don't 
have the experience with them and don't know if they are using C 
runtime somewhere inside or handle that low level OS/syscalls 
stuff by itself.


More information about the Digitalmars-d-learn mailing list