A common way to implement PIMPL in C is to do this:typedef struct _Opaque Opaque;Opaque* createOpaque();void doSomething(Opaque *opaque);Or:typedef struct _Opaque* Opaque;Opaque createOpaque();void doSomething(Opaque opaque);The first requires that the caller treates Opaque as a pointer, the second requires that the caller treates Opaque as a value.The asterisks don't make the code any more readable, but are there any hidden dangers of typedefing it away? Given the choice between the two styles, which should be preferred?
Should opaque pointers be pointers or types?
c;pointers;type safety;typedef