RE: [RFA] Handle BINOP_INTDIV in valarith.c

Pierre Muller
2008-01-21T10:45:30Z

> If this patch is approved, please document this operator in the
> "Pascal" node of the user manual.

Hi Eli,

as I got the approval of Joel, I
committed this patch last week.
But I had an email connection problem
last week that prevented me from replying to
your email.

Concerning the pascal 'div' operator
subject of my patch, I must admit that
there is no reason to add it to 'pascal' node,
because there is basically nothing in that node yet,
and the little that is present is obsolete anyway.

I would need to rewrite completely, I will try to work on this.
The BINOP_INTDIV seems to be used also
in fortran language (f-lang.c:237)
and modula-2 language (m2-exp.y:430 and m2-lang.c:290)
But there seems to no test this feature, as I saw no
testsuite change.
I will add a pascal testsuite that
does test this feature.

I have another problem with the '/' operator:
for pascal and contrary to C language
'/' is always returning a float value, even if both
left and right nodes are integers.

I will send a separate patch for
a new binop called BINOP_FLOATDIV
that will force the result of 'a / b' to be a
float in all cases.

This is the right thing to do for pascal,
but I don't know about the other languages:
do fortran, Ada, Modula-2 or java
allow 'a / b' for a or b of integer types?

Pierre Muller

Pascal language maintainer.