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

It's all fun and games until you say

    ++p
and pass that to a function that is silently expecting a length and other stuff in front of it. Calling these things "pointers" is a bit of a promotion from what they really are. Naming them "char*" or whatever is pretty dangerous if you ever do pointer movement.

Seriously, if you want descriptors and typed blobs, just make up a struct for what you want and pass it around. Say what you mean. Lying like this is going to hurt you.



This is also a common, and sometimes exploitable, coding error with C++ smart pointers.

I agree with you: I'm not sure how this is any more powerful than any encapsulated ADT-style foo_t-wraps-a-void-star C library.


Well with C++ unique_ptr and shared_ptr you cant ++ or += or even get a raw pointer without explicitly calling .get().


That's what Cello is about I think.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: