top | item 35091713

(no title)

potro | 3 years ago

A quote from the article:

> A distinctive feature of Zig is that it does not deal with memory allocation directly in the language. There is no malloc keyword like in C/C++. Instead, access to the heap is handled explicitly in the standard library.

I guess it is all you need to know about the article quality.

discuss

order

loeg|3 years ago

The point that paragraph is trying to make but articulates imperfectly is that you explicitly pass an Allocator to the stdlib routines that allocate -- rather than having them allocate on the heap implicitly.

hawski|3 years ago

Yes, but it still is a part of the standard library and how the standard library does things - a convention. Same as in C, as malloc is just a function. You could create a replacement library for C stdlib and it could also expect an allocator in the parameters if a given function could allocate.

jenadine|3 years ago

So you have coloured functions? The red that can allocate, and the blue that cannot?