[M3devel] what to do about file sizes being 32bits?

Jay K jay.krell at cornell.edu
Fri Jan 8 02:45:03 CET 2010


I understand "full range" is a problem, because, something like,

the set of operations isn't closed.

 

 

I believe you need to define multiple types and/or

multiple operations.

 

 

You need an ability to trap/fail on overflow.

You need an ability for silent wraparound on overflow.

You need perhaps a way to add precision as needed. Slow.

You need perhaps a way to specify arbitrarily high precision,

  and then, again, either trap/fail or silent wraparound.

 

 

Basically, in my opinion, having just "INTEGER" and just "+"

isn't nearly sufficient.

 

 

Not having operator overloading makes pretty much any solution painful to use.

 

 

We and C both have a compromise that covers most cases and

when people really need higher fixed or arbitrary precision, they

either give up the convenient "operator" syntax or use C++.

 

 

As I understand, in C, unsigned integers are defined to "silently wraparound"

and signed integers are implementation defined, could "trap" but in reality

all implementations "silently wraparound".

It is a point of unsafety though, beyond the more well known

buffer overflows, leaks, etc.

 

 

 - Jay

 
> Date: Thu, 7 Jan 2010 19:22:00 -0600
> From: rodney_bates at lcwb.coop
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] what to do about file sizes being 32bits?
> 
> Full-range unsigned integers are a language designer's headache, because
> there are conflicts no matter what you do. The Modula-3 approach is to
> use the operations in interface Word.i3 (and now Long.i3) on type
> INTEGER (not CARDINAL, which has only half the range). These apply
> unsigned interpretation to values of type INTEGER.
> 
> hendrik at topoi.pooq.com wrote:
> > On Thu, Jan 07, 2010 at 06:59:31AM +0000, Jay K wrote:
> >> File.i3:
> >>
> >>
> >> Status = RECORD
> >> type: Type;
> >> modificationTime: Time.T;
> >> size: CARDINAL (* oops... *)
> >> END;
> >>
> >>
> >> What to do?
> >> [0.. higher than 7FFFFFFF] doesn't "just work".
> >> higher than 7FFFFFFFF is not legal on 32bit, unless you put "L" on the end,
> >> which presumably has some relationship to turning it into a LONGINT, which
> >> causes users to fail to compile
> > 
> > In any case, is the proper type for file offsets [0..7fffffffffffffff] 
> > or [0..ffffffffffffffff]? I suspect the latter. It might take some 
> > effort to make that legal in Modula 3.
> > 
> > -- hendrik
> > 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100108/21906409/attachment-0002.html>


More information about the M3devel mailing list