Am Freitag, 25. Mai 2007 schrieb Giel van Schijndel:
> Giel van Schijndel schreef:
> > Christian Ohm schreef:
> >> On Wednesday, 23 May 2007 at 22:46, Giel van Schijndel wrote:
> >>> Christian Ohm schreef:
> >>>> Some g++ fixes again. "new" is a reserved keyword, a few casts, and
> >>>> I've moved OggVorbisDecoderState into oggvorbis.h, there was a linker
> >>>> error when it was typedeffed to void in some cases. Don't know why it
> >>>> was done that way, still works for me now. I've removed an #ifdef
> >>>> WZ_NOOGG, but ./configure --disable-ogg was broken before anyway.
> >>>
> >>> That double typedef was done to encapsulate the OggVorbis decoding
> >>> code, compare it to a C++ pimpl if you wish. The linker error is caused
> >>> by C++'s function overloading, so the correct fix is not to expose
> >>> details, but disabling function overloading for that function: extern
> >>> "C".
> >>
> >> Hm, in C this looks quite inelegant to me; just because the struct is
> >> exposed to the outside doesn't mean you have to access it directly. In
> >> C++ the whole class is exposed as well, you just have the access control
> >> via private (unless you just use pointers to the class; I've thought
> >> about that as well but was too lazy to try to rewrite the code that
> >> way).
> >
> > I have to agree that it is quite inelegant. Although my approach isn't
> > similar to C++'s private keyword, it's more equal to the Pimpl idiom. (
> > http://www.gamedev.net/reference/articles/article1794.asp )
> >
> > However the void* pointer indeed isn't nice. Therefore I've now taken a
> > new approach to this: forward declaration of the struct (which is enough
> > to create a pointer to it). It does, however, require the addition of
> > the keyword 'struct' in front of every declaration of
> > OggVorbisDecoderState or pointers to it.
> >
> > Patch is attached for review. I haven't looked into a typedef solution
> > to eliminate the struct keyword yet, so if you happen to know one right
> > away, please tell me.
>
> Sorry forgot to mention, with "review", I meant whether no-one objects
> this approach. Especially the resulting consequence of needing to
> specify "struct" for each declaration additionally.
Afaik you don't need to mention the struct in the C file.
Using the typedef should be ok.

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to