curl-library
Re: [PATCH] typedef void CURL - compiler typechecking
Date: Tue, 20 Mar 2007 00:41:11 +0000
Robert Iakobashvili wrote:
> >The struct is still undefined, as if it was still a void pointer. The only
> >difference is that compiler can print a warning if a multi_handle is passed
> >as an easy_handle somewhere.
>
> I our project we already had the cases, where people made soft-links,
> copied, etc to get access to internal structures.
If they are going to do that sort of thing, they can do it with the
"void *" declarations too. There are many ways.
You can't stop people accessing the internal structures if they insist
on doing things they shouldn't to access them.
But you can use an undefined struct to get better compile-time type
checking for people who use the source as intended. It's what I do in
my libraries, as do many others.
-- Jamie
Received on 2007-03-20