Alex Robinson wrote:
> Over that last few years I've changed my own code to "opaque" pointers.
> That is, the .H file contains something like this:
> 
> typedef struct {
>         Byte    dummy;
>         } A_THANG;
> 
> And the .C file does this:
> 
> typedef struct {
>         int     real_stuff;
>         long    more_stuff;
>         Byte    etc;
>         } A_THANG;
> 

I use something similar to get opaque pointers:

In the public .h file I have
        typedef struct A_THANG A_THANG;

And in the .c file (or a private .h file):
        struct A_THANG {
                int real_stuff;
                ...etc...
        };

Then clients who include the public file can use "A_THANG *" but cannot
declare A_THANG variables directly, and cannot dereference A_THANG
pointers.

--Mark

Reply via email to