<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Integer overflow is not a safety problem. That was the news (to me).<BR>
Subranges do need to be enforced, at certain points, for their to be safety.<BR>
This change doesn't change that.<BR>
(Compiler bugs break safety, as always.)<BR>
<BR>
- Jay<BR><BR><BR>> Date: Sat, 13 Mar 2010 13:29:24 -0500<BR>> From: hendrik@topoi.pooq.com<BR>> To: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] comparisons vs. subranges<BR>> <BR>> On Sat, Mar 13, 2010 at 10:19:21AM +0000, Jay K wrote:<BR>> > <BR>> > <*UNUSED*>PROCEDURE CardinalGE0(a:CARDINAL):BOOLEAN=BEGIN RETURN a>=0; END CardinalGE0;<BR>> > <*UNUSED*>PROCEDURE CardinalEQN1(a:CARDINAL):BOOLEAN=BEGIN RETURN a=-1; END CardinalEQN1;<BR>> > <BR>> > <BR>> > <BR>> > <BR>> > Seems to me, the front end should notice these.<BR>> > <BR>> > The first should always be TRUE.<BR>> > <BR>> > And possibly, possibly warn.<BR>> > <BR>> > The second should always be FALSE.<BR>> > <BR>> > And possibly, possibly warn.<BR>> > <BR>> > <BR>> > <BR>> > "Generic" programming often hits this sort of thing though, a good reason not to warn.<BR>> > <BR>> > Programmer might also be working with existing code and have changed INTEGER to CARDINAL.<BR>> > <BR>> > Or be defending against future maintainers changing CARDINAL to INTEGER.<BR>> <BR>> Wasn't there a discussion a while ago about subranges out-of-bounds not <BR>> being a safety problem? (Or was it arithmetic overflow?) This <BR>> optimisation might well cause a quite hard-to-find bug if we don't <BR>> guarantee subrange integrity.<BR>> <BR>> -- hendrik<BR> </body>
</html>