
Sohail Somani wrote:
I don't particularly like requiring implicit function declarations. I'd rather tie them to the resource pointer type somehow. That's just my own preference which may or may not be totally wrong (but its not). I think its too easy for people to forget to do it. I prefer parameterized type + typedef.
My view on the issue is, that if a designer follows RAII (or should I say RRID) there is no need for such a thing. So I don't see why third-party issues should affect our interfaces. Anyway, I don't have too strong of an opinion about it.
The only other option is using a type erasure mechanism like shared_ptr which is more trouble than its worth for things like deallocating C resources.
I was referring to the file pointer, which is pretty much the only "C resource" I use. You're right when it comes to malloc/free, of course - but do we really need it?
Anytime you deal with C atleast, the answer is yes.
I doubt it's good practice for a C library to allocate stuff and hand it to the user who has to then free it or to free stuff that comes from the user... The other cases are: a) it's up to the user to obtain the memory, so new/delete will work b) the library provides ctor/dtor routines, so custom deleters are needed Regards, Tobias