[m-rev.] diff: implement some formatting functions for .NET

Tyson Dowd trd at cs.mu.OZ.AU
Tue Aug 28 19:53:36 AEST 2001


On 28-Aug-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Index: runtime/mercury_mcpp.cpp
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.cpp,v
> > retrieving revision 1.9
> > diff -u -r1.9 mercury_mcpp.cpp
> > --- runtime/mercury_mcpp.cpp	2001/08/27 12:15:36	1.9
> > +++ runtime/mercury_mcpp.cpp	2001/08/27 15:30:10
> > @@ -80,6 +80,18 @@
> >  	return w[index];
> >  }
> >  
> > +static bool list_is_cons(MR_Word w) {
> > +	return (System::Convert::ToInt32(w[0]) != 0);
> > +}
> > +
> > +static MR_Box list_get_head(MR_Word w) {
> > +	return w[1];
> > +}
> > +
> > +static MR_Word list_get_tail(MR_Word w) {
> > +	return dynamic_cast<MR_Word>(w[2]);
> > +}
> > +
> >  };
> >  
> Why the dynamic_cast for get_tail and not for get_head?

Get head returns object, but get tail returns a list (object[]).

Whatever element we retrieve from the array is an object already, so no
cast is required unless we want to convert it to a different type.

Tyson. 
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list