Source-Changes archive

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

Re: CVS commit: src/include




On Feb 18, 2006, at 4:29 AM, Elad Efrat wrote:

would it be possible to avoid memory allocation and just typedef
the struct? (say, pw_policy_t)

No, simply typedef'ing the struct still exposes the size and internal layout to callers unless you do:

typedef struct pw_policy *pw_policy_t;

in the public header file and declare pw_policy ONLY in pw_policy.c. In this case, you still need to use malloc to allocate the structure on behalf of the caller.

I still prefer having the typedef, because I think that's a cleaner way to pass around pointers to opaque data types.

-- thorpej




Home | Main Index | Thread Index | Old Index