[M3devel] cm3 regression

Jay jayk123 at hotmail.com
Wed Apr 16 16:08:11 CEST 2008


> > it'd be nice imho for    the language or m3core to also build-in UINTEGER, INT8, INT16,
> > INT32, INT64, UINT8, UINT16, UINT32, UINT64, just so folks wouldn't   
> > have to provide them themselves. (CARDINAL I don't think is what I   
> > want.)
> > Add them somewhere in m3core?
> > MODULE Integers; ?
> 
> Such things may be convenient for programmers, but are left out of the
> language because the specification must not become too long, I think.
> I'd opt for library extensions in this case.

Good enough.
Except I'm not sure about UINTEGER..like..why is CARDINAL only half range?
I'd have to dig in..NOT now..

> Yes, IIRC there are no checks on integer overflow; this is an
> implementation flaw. How would you provide this? Add generation of
> checks on every integer operation?

Well, it's a no-win situation.
The check would bloat the code.
Even function calls would bloat and slow.
Probably function calls.

And then hopefully optimize them some.
For example:
FOR i := 0 TO n DO
   ...
END;

Check up front then n isn't negative, and then no checking is needed for the incrementing of n to overflow.

Similarly,
FOR i := 0 TO n BY 2 DO

   ...

END;

or whatever is the syntax, check if the start/end are divisible by the increment and the start is less than the end, and then no overflow check needed.


I guess on most architectures every add/sub/mul/div instruction would tend to have one additional instruction, a conditional branch, after it.
It will take some investigation.
Perhaps gnat (GNU Ada compiler, part of gcc) or gpc (Pascal, I think likewise, maybe) already provide this though.
Maybe just some simple reuse.

There'd probably be pragmas or other types to choise behavior, esp. in unsafe modules.

Anyway, none of this particular soon, at least by me, I have a bunch of other things I want to do or see done first.
But sure we can talk about it or someone else can do it. :)

 - Jay

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080416/aae3145a/attachment-0002.html>


More information about the M3devel mailing list