Stupid Smart Pointers in C

Viewed 3
The discussion around 'stupid smart pointers' in C highlights the inherent risks and challenges associated with memory management in the C programming language. It underscores the opinion that creating advanced memory management techniques in C may lead to portability and safety issues, especially given C's lack of inherent memory safety. Users suggest alternatives such as using the '__attribute__((cleanup))' feature, supported by GCC and Clang, which offers a more manageable approach to automatic resource management. They also recommend employing pool allocators like Samba's talloc or Apache's APR for better memory handling. Additionally, there's concern regarding how certain memory management strategies, such as reference counting, can introduce bugs and complicate CPU interactions, particularly regarding performance metrics like branch prediction and compiler optimization.
0 Answers