Re: Ranges and (non)static constraints



Robert A Duff wrote:

OK. I'm sure I will enjoy reading the RM for it someday.

As I will yours.

But are you sure you want to define it by what it is NOT,
rather than what it IS? ;-)

I'll define it by what it is, and name it by what it isn't.

String_Index seems reasonable for indexing strings. Machine_Integer
seems reasonable for a type that matches the machine's register size
(but it should not be in Standard). I think one wants a way to say
(e.g.) that a type ranges from 1 up to at least a million, but it's fine
to go beyond that, and please make it efficient (for example, perhaps
round it up to 2**31-1).

Instead of Machine_Integer, perhaps we want a way to define a type that
can count the number of Mumble objects, given that if we create more
than some number of Mumble objects, or an array of them, we can be sure
this count will not overflow. That is, we would have run out of
(virtual) memory before that count overflows.

That would have to be a dynamic type, as the actual upper bound could not generally be known at compile time.

--
Jeff Carter
"Ditto, you provincial putz?"
Blazing Saddles
86
.



Relevant Pages

  • Re: interrupting for overflow and loop termination
    ... > only this int can ever overflow. ... maybe all you need is a sticky overflow bit. ... When a user-level instruction X caused an exception, ... The CAUSE register was set to indicate the reason. ...
    (comp.arch)
  • Re: Formatting in assembly
    ... not the overflow of assembly "mul" (multiplication is not intended ... The result is stored in register AX, register pair DX:AX, or register ... If the high-order bits of the product are 0, the CF and OF flags are ...
    (alt.lang.asm)
  • Re: Integer arithmetic, multiplication overflow
    ... > If the result register of an integer multiplication instruction is twice ... > as wide as the factor registers then overflow will never occur. ... to design general addition / subtraction algorithm ...
    (sci.math)
  • Re: Yet Another Spinoza Challenge
    ... Undefined behaviour is to make it easy to write optimising compilers. ... By saying "the behaviour on overflow is undefined" ... both the compilers can simply emit the code register a = register b + ...
    (comp.lang.c)
  • Re: Selective suppression of warnings --- gnat on GNU/Linux
    ... Robert A Duff a écrit: ... because of overflow semantics for intermediate ... Of course, if you compute more than single additions, a real analysis has to be done to determine the bounds of Big_Enough. ...
    (comp.lang.ada)