[m-dev.] for review: cleanup of type_ctor_infos, part 2

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Mar 9 14:36:03 AEDT 2000


On 08-Mar-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > +:- pred rtti__make_exist_locns_name(rtti_type_id::in, int::in,
> > +	string::out) is det.
> 
> What does the int argument to this predicate represent?

If you had looked at the later diff, you'd have seen that this predicate
doesn't exist anymore.

> > +		{ FunctorsInfo = du_functors(DuFunctorsInfo) },
> > +		io__write_string("{ (Integer) "),
> > +		output_rtti_addr(RttiTypeId, DuFunctorsInfo),
> > +		io__write_string(" }")
> 
> Hmm... here you are casting pointers to integers,
> and you're using the resulting expressions in static initializers, right?
> If so, I'm not sure that is guaranteed to work.

The functors and layout fields of the type_ctor_info structure are unions,
most members of which are pointers, but one member is a pseudotypeinfo,
which can be either a (tagged) pointer or an integer.

Would declaring this field to be "void *", and casting to void * instead of
Integer be portable?

Zoltan.
--------------------------------------------------------------------------
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