4 ms·
Cool! From a very quick look, the sample code prints 'r' instead of 'str' which was confusing. Also, is 'str' leaked or freed with 'r'?
by unwind 5y ago
Cool!
From a very quick look, the sample code prints 'r' instead of 'str' which was confusing. Also, is 'str' leaked or freed with 'r'?
- josephg 5y agoIn the C example str is heap allocated, so it’s not associated with r and leaked in that example. I should free it to make that clear! After writing a lot of rust code this year it’s sort of weird reading that, and seeing that aspect of the code not be explicit or obvious.