T
tm
This is new form that, so far as I know, is unimplemented and not yet
defined. My comments may well have been different if this had been
the proposal you seemed to be putting forward.
Originally, you seemed to be suggesting a compiler intrinsic to access the
processor's overflow flag.
I think this is approach is too simple.
I use C as target language for my Seed7 to C compiler.
I would be happy if C had some overflow checking.
But I understand that there are also places where the
classic behaviour without overflow checking is needed.
I want to raise overflow exceptions (emulated with
setjmp, longjmp) in Seed7. C with overflow checking
would make this easier.
Checking the processor's overflow flag costs time and
there should be a cheaper way to handle overflows.
I guess that there are processors which can trigger an
interrupt (which could call a function or cause a
longjmp to happen) when the overflow flag is set.
This way the overflow check would cost nothing.
I propose intoducing new types with overflow checking.
The classic types int, long, ... would keep the
behaviour of ignoring overflow. New types like
checkd_int, checkd_long could be used for values which
need overflow checking.
When an overflow occurs a callback function could
be called. Based on this an exception mechanism can
be realized.
Greetings Thomas Mertes
--
Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.