Re: [RFA] Handle BINOP_INTDIV in valarith.c

Tom Tromey
2008-01-23T19:07:33Z

>>>>> "Pierre" == Pierre Muller <muller@ics.u-strasbg.fr> writes:

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

For Java the normal binary promotion rules apply to '/'.

That is: if either a or b is double, the other is promoted to double.
Then likewise for float.
Then likewise for long.
And finally, if none of those apply, both are promoted to int.

So IOW, yes :)

There are also special rules about certain integer divisions.
Division by zero throws an exception, and MIN_INT/-1 is defined to be
MIN_INT.

In Java 5 there is also unboxing, but we never updated gdb to know
about that.

Tom