3 ms·
This syntax relies on destructors, which C doesn't have.
This syntax relies on destructors, which C doesn't have.
One could pass in a cleanup function that will be called - but this is very similar to gcc’s cleanup attribute.
The Java implementation doesn't use destructors. The AutoCloseable interface only has the one close() method, so for C a callable function would do.