lua-users home
lua-l archive

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

It was thus said that the Great Dirk Laurie once stated:
> 2016-01-14 22:39 GMT+02:00 Tom N Harris <>:
> > Lua doesn't hide the imprecision of floats, nor do I think it should
> > hide the overflow of integers.
> I grew up in a time when integer overflow caused a program to
> crash unless you had explicitly set a CPU flag that would make
> it wrap around. Don't modern machines have such a flag, only
> by default it is off? And if so, is the feature accessible from C?

  The only architecture I know of [1] that can do that is the VAX
architecture [2].  The MIPS can trap overflow, but it requires the use of
separate instructions (ADD instead of ADDU that every C compiler seems to
use).  Such features aren't necessarily accesible from C in a portable
manner, although compilers might support options to enable/disable such

  I did some microbenchmarks on this [3] and it doesn't seem to add that
much overhead on modern machines [4].


[1]	I'm not saying it's the only one, just that it's the only one I know

[2]	Sweet system and the most regular and orthogonal CISC architecture
	I've come across.


[4]	Intel.