[m-dev.] for review: cleanup of type_ctor_infos, relative diff 1
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Mar 9 14:47:30 AEDT 2000
On 08-Mar-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > +:- type module_sub_info --->
> > + module_sub(
>
> That change does not match the layout conventions documented
> in the "Layout" section of our Mercury coding standard.
No, but it does avoid several
> > diff -rub --exclude CVS ws15.base/runtime/mercury_deep_copy_body.h /home/ender2/zs/ws15/runtime/mercury_deep_copy_body.h
> ...
> > @@ -513,9 +556,14 @@
> > case MR_TYPECTOR_REP_STRING:
> > {
> > Word *data_value;
> > - int data_tag;
> > + Word data_tag;
> > +
> > + /*
> > + ** Not all Mercury strings are aligned; in particular,
> > + ** string constants containing the empty string may be
> > + ** allocated unaligned storage by the C compiler.
> > + */
> >
> > - /* XXX simplify: tag should be zero */
> > data_tag = MR_tag(data);
> > data_value = (Word *) MR_body(data, data_tag);
>
> Hmm, the code here doesn't make sense in light of the comment.
> If the pointer is not aligned, won't stripping off the tag
> give the wrong result?
The following code was not using either data_tag or data_value, except
to test whether data_value was in range; I therefore deleted them and
modified the test to test the variable data directly instead.
> It's still not clear to me why the layout_init alternative is needed.
Because unions in C do not allow you to say which member you are initializing,
and force you to initialize the first member. I want to make sure that the
cast to the first member will work properly.
--------------------------------------------------------------------------
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