include files bug?
Andreas Hauser
andy at splashground.de
Tue Aug 16 04:12:16 PDT 2005
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:
FILE
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.
Andy
More information about the Bugs
mailing list