Re: [RFA] Handle BINOP_INTDIV in valarith.c

Joel Brobecker
2008-01-23T18:25:38Z

> 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.

That seems unnecessary to me unless BINOP_DIV and your BINOP_FLOATDIV
have different meanings in Pascal? Otherwise, I think the problem is
that the pascal language needs its own expression evaluator so that
it can handle the '/' operator specifically. The rest can be delegated
to the standard expression evaluator.

> 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?

Ada does, but it's an overloaded operator, so the type of the result
depends on the type of the arguments. Don't know about the other
languages.

--
Joel