Closed eaglexiang closed 7 years ago
smart
is just a macro define that expands to __attribute__((cleanup(sfree_stack)))
. The cleanup
variable attribute is documented as calling its parameter on the annotated variable when it goes out of scope.
I've written a more extensive blog post on the implementations of smart pointers w/ GNU C99, you might want to give it a read.
Amazing! I've got the point.
It's so wonderful that you implement the
smart
type attribute!Could you tell me how you did this? I can't find doc related to
user defined type attribute for C/C++
, but onlyuser defined type
.Thank you very much!