Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

GCC has a pure attribute for functions which is documented as being prohibitive of impure behavior. Though, I honestly cannot say how thoroughly it is enforced or if there are significant benefits outside of the obvious and some minor optimizations which the compiler might be able to perform.


It's not enforced. It's a promise. If you mark a non-pure function pure, then you are going to have a bad time.

I would also be reluctant to mark any function pure that takes pointers as arguments (directly or indirectly).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: