[m-dev.] for review: cleanup of type_ctor_infos, part 2
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Mar 9 16:32:25 AEDT 2000
On 09-Mar-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> > > + { 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?
It wouldn't be standard-conforming, but I think that in practice yes,
it would be portable.
(C99 includes an extension that solves this problem: you can specify
which member of the union you want to initialize. But of course C99
is not yet portable in practice ;-).
--
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