cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] typedef void CURL - compiler typechecking

From: Gerrit Bruchhäuser <gbruchhaeuser_at_nero.com>
Date: Mon, 19 Mar 2007 15:16:30 +0100

Am Montag 19 März 2007 15:02 schrieb Robert Iakobashvili:
> On 3/19/07, Gerrit Bruchhäuser <gbruchhaeuser_at_nero.com> wrote:
> > > On 3/19/07, Daniel Stenberg <daniel_at_haxx.se> wrote:
> > > > On Mon, 19 Mar 2007, Gerrit Bruchhäuser wrote:
> > > >
> > > > The patch is incorrect:
> > > > > +typedef struct Curl_multi* CURLM;
> > > >
> > > > Neither of the typedefs should be pointers, they should be structs as
> > > > they were previously 'void' and not 'void *'.
> > > >
> > > > This minor mistake aside, is there anyone who believes this could
> > > > possibly break the ABI if introduced now?
> > >
> > > It may open a way for some bloody hacking with castings, etc instead
> > > of working via API.
> > > Just recently I have used curl as an example of real encapsulation
> > > and good style of C-programming.
> >
> > 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.

Thats awefull. But where does the patch encourage such behaviour? The only
thing the typedef makes is helping the compiler determine type mismatches so
it can print a warning. One will (with and without the patch) not legally be
able to access the structure elements because the structure itself is locally
defined and still not exposed to the user
Received on 2007-03-19