[m-dev.] For review: Using MR_TypeCtorInfo for generated type_ctor_infos

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Aug 6 19:10:38 AEST 1999


On 06-Aug-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> I agree that this is the right fix. The right value to substitute for
> uniform(no) is
> 
> 	initial([1 - integer,
> 		3 - code_ptr,
> 		1 - XXX
> 		2 - data_ptr
> 		2 - string], none)
> 
> The XXX represents the llds_type of the representation field. If C compilers
> are guaranteed to accept an initialization of a struct field whose type is
> an enum with an int, then setting XXX = int will do.

Yes, in C the type of every enum constant is `int', and assignments
and initialization of enums to/from ints is allowed without needing casts.

The situation is different in C++, but I don't think we need to worry
about that here.

> I am also not sure that we won't get warnings if we cast small integers to
> the Word * type of the layout and functors fields.

So long as the appropriate casts are there, then that should be fine.
With the fix described above, llds_out.m should insert the casts automatically.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list