|
|
|
|
|
by kitd
54 days ago
|
|
> I've also found that using those attributes inherently pushes your code to make ownership more explicit. I personally stopped being terrified of double-pointers and started using them for ownership transfers, which eliminates a large class of bugs. This is very interesting. Do you have a practical example? |
|
void *__free p = NULL;
func(&p); // func zeroes p to claim ownership
// end of scope, p is NULL, nothing happens // if func was not called, p is freed