[mercury-users] Making Mercury code conditional on the grade?

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Jul 21 12:09:33 AEST 1998


> I was wondering if there was a convenient way to make Mercury code depend on
> the grade with which it is compiled?  Currently I've just created a new
> predicate, implemented using a pragma c_code, which uses an appropriate
> #ifdef to do the (in this case trivial) piece of work which is conditional.
> 
> Is there a better (or an "approved") way of doing this kind of thing?  (E.g.
> am I ignorant of some feature which makes it easy?)

Yes, there is a better way of doing it. Runtime/mercury_grade.h shows how
the various components of the grade depend on various #defines; test the
appropriate #defines instead (e.g. #ifdef MR_USE_TRAIL).

I am not aware of this being documented; perhaps it should be.

Zoltan.



More information about the users mailing list