DragonFly BSD
DragonFly bugs List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: include files bug?

From: Andreas Hauser <andy@xxxxxxxxxxxxxxx>
Date: 16 Aug 2005 07:46:56 -0000

joerg wrote @ Tue, 9 Aug 2005 20:11:43 +0200:
> On Tue, Aug 09, 2005 at 04:49:24PM +0100, Stefan Krüger wrote:

> > here's some code which did not compile:
> > 
> > #include <openssl/md5.h>
> > int main() { return 0; }
> > 
> > -------
> > 
> > #include <stdio.h>
> > int main() { sizeof(FILE); return 0; }

> You are not supposed to access FILE directly, it's opaque simply to
> avoid any stupid uses. E.g. you can't copy a FILE object to a different
> location and expect it work, you can't just access it (because the
> layout is opaque), the only valid way to create a FILE is via stdio --
> so what should sizeof(FILE) be allowed for?

You wrote in the commit message:
  Make FILE an opaque type for normal operation (anything outside libc).
  This means programs have to use the exported interface, they can neither
  make static instances on the heap or access fields of their own.

That seems to break SUSv3:
  The following data types shall be defined through typedef:
      A structure containing information about a file.

Maybe if one uses something like:

struct FILE { char opaque[SOME_SIZE]; };

This might also solve the stlport problems.

> The reason why I haven't fixed ruby is that I don't have any idea what
> they use it for.

I think, they just have generic ways to deal with objects and pointers.
The generic pointer structure contains a field for the size of the pointee.


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]