[m-users.] documentation for foreign_export_enum

Matthias Güdemann matthias.guedemann at googlemail.com
Fri May 22 23:44:48 AEST 2015


Hi Julien,

> Incidentally, the Mercury runtime already provides C definitions for
> the constructors of the comparison_result/0 type -- see ``C data
> passing conventions'' in the reference manual.  (The data constructors
> can be referred to in C as: MR_COMPARE_LESS, MR_COMPARE_EQUAL and
> MR_COMPARE_GREATER.)

thank you for the hint.

I had been wondering about the default mapping from constructors like
(>), (=), (<) to C identifiers. When one specifies neither Attributes,
nor Overrides in the pragma for comparison_result/0, the comiler
complains with:

,----
|   error: not all the constructors of the type `builtin.comparison_result'/0 can be converted into valid C identifiers.
`----

as using the default mapping as described in "14.9.1.2 Using pragma
foreign_export_enum for C" does not result in valid C identifiers.

Matthias



More information about the users mailing list