[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: INC/DEC behaviour



Guy wrote:

> > I would like to see the INC/DEC type compatibility exactly the same
> > as the statements:
> > 
> >       i:=i+j   or i:=i-j
> 
> I think the issue is: which of the two semantics maps more directly 
> and transparently to the machine-level.
> IMO, INC/DEC as mere shortcuts for the above assigments wouldn't have 
> made it into Oberon. It seems to me they were kept for efficiency 
> and because they correspond directly to machine-level instruction.
> So we should try and understand whether the ETH version is still, in
> general, more efficient to implement on todays CPU's and if so, thats 
> the way to go.

I can only speak for a RISC processor.  In those, everything is
always a 32/64-bit integer (at least when kept in registers).  So
from that perspective there shouldn't be any efficiency concerns
since conversions of SHORTINTs to LONGINTs is a NOP.  Conversions
to LONGINTs are always done automatically when loading shorter
integers from memory (or storing them).

Michael Griebling