Get the latest tech news

Stupid Smart Pointers in C


Stupid Smart Pointers in C

Calling free_on_exit stores the passed pointer and sets the caller's return address to trampoline. trampoline.SIn this article we've shown how to build a simple and incomplete smart pointer on an 32 bit x86 architecture. I recently discovered the implementation of free_on_exit won't work if called directly from main if gcc aligns the stack.

Get the Android app

Or read this on Hacker News