[m-rev.] for review: avoid passing type infos to C code
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jul 9 16:59:43 AEST 2001
On 09-Jul-2001, David Jeffery <dgj at cs.mu.OZ.AU> wrote:
> mercury/compiler/polymorphism.m:
> Do not pass a type-info to C code that does not use the variable.
> To check if the C code uses the variable, we simply check for the
> occurence of the variable name in the string that represents the C
> code. This is potentially unsafe if the user decides to do something
> horrible with the preprocessor, but I don't think this needs to be
> specially documented --- AFAIK there is no user-visible documentation
> about passing type-infos to and from C anyway.
That change looks OK. I think it's an improvement on the current status
quo, so I'd be happy for you to commit it as is. But I do have some
suggestions for improvments.
Shouldn't you do the same thing for the typeclass_info variables,
as well as for the type_info variables?
Also, I'd prefer it if the code which checks whether the foreign code
references the variable was put in a separate sub-routine.
As you say, there might possibly be some ramifications for other
languages, so ideally the foreign_language would be passed in
as a parameter to this routine, so that it can easily be changed
to handle different languages differently if need be.
P.S.
The routines that you're modifying are misleadingly named;
they're called *c_code* but actually they handle foreign procs,
whatever the language. We should fix that... but as a separate change.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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