On Thu, Aug 15, 2002 at 11:44:59PM +0900, ts wrote:
>  Data_Make_Struct() is *not* dangerous. The goal of Data_Make_Struct()
>  is to call ALLOC(), initialize all members of the struct to zero then
>  call Data_Wrap_Struct()

This is a problem, though, because setting a struct to all zeroes
is not the same as initializing all members of the struct.  It is
impossible to write a macro in C that can properly initialize all C
structs in a generic manner.

In C++, for example, a class is not initialized until its constructor
has completed.  I might find it convenient to use Data_Make_Struct and
then to use placement new to initialize the object, but this would be a
bug.  Instead, I should call ALLOC, use placement new on the allocated
structure, then call Data_Wrap_Struct to wrap the object.  I have to be
very careful of exception-safety issues if I do this.

The same applies in C to any structure that has non-trivial
initialization.  If you have non-trivial initialization, then perhaps
Data_Wrap_Struct is more appropriate for your application.  I agree with
ts that THIS DOES NOT make Data_Make_Struct dangerous; it is only
dangerous when used incorrectly.

Paul