Limited "generics" in C without macros or UB
Read OriginalThis technical article details a C programming pattern that mimics limited generics by using multiple definitions of an incomplete struct type (wlr_output_state) across different modules. It explains how this approach, used in projects like wlroots, reduces reliance on void* pointers for improved type safety and code clarity, while acknowledging its limitations and eventual rollback due to Link Time Optimization (LTO) issues.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser