🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2572

Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++)

#2572
From: Viet-Trung Luu
Date: Mon, 02 Oct 1995 02:24
59 lines
3759 bytes
On Sat, 30 Sep 1995, Lawrence Kirby wrote:

> Actually I believe that is one of its strengths that has facilitated its
> spread over many platforms and its widespread use.

Maybe. It has certainly made supporting different platforms easier, but 
it has also made porting applications more difficult (especially to 
MS-DOG -- then again, this toy OS has memory limitations too).

> 16 bit values are enough for a surprisingly large number of circunstances.
> If you want an integer that is at leas 32 bits wide C provides the long type
> which has precisely this definition. If you want a type that is as close
> to 32 bits as possible (but no less) and are afraid that longs will be
> too long you can trivially set up a suitable typedef using the preprocessor.

16-bit values are enough for many applications -- I'll agree with that. 
For 90% of indexing operations and the like, it is easily good enough. 
However, as soon as you start multiplying... 16-bit values really get in 
your way.

What I'm saying is that though the 16-bit integers have been adequate in 
the past, they will no longer be adequate in the future. Often there is 
no need for 64-bit values, but that's what you'll get if you use ints on 
64-bit machines -- this isn't so bad. But if you use ints, sometimes you 
might end up with 16-bit values.

I just think that the standard should be moved up: ints should be *at 
least* 32-bits (64 wouldn't be too bad either), and longs should be 64-bit.

> As stated C provides exactly that - it is called a long.

I just think that 32-bit values are the starting point for "reasonable". 
And what if you want extra-long values? There's always GNU's long long, I 
guess, but that's non-standard.

> As yet I have not seen a single valid use for an exact 32 bit integer (at
> least not in portable code). This idea seems to come up a lot but nobody
> seems to be able to suggest an application for it that can't be reasonably
> done in an 'at least 32 bit' type. The nearest seem to be dealing with
> external data formats but even these are subject to problems like byte
> ordering and there are non-trivial standards and libraries to do this sort
> of thing correctly.

I guess I've changed my mind on this (sort of). For the most part, 
libraries could be built to handle exact-sized values (as well as byte 
ordering). However, some sort of standardization would be nice 
(otherwise, you get a myriad of typedefs, most meaning exactly the same 
thing).

> I see this is cross-posted to comp.lang.ada which I understand has such
> facilities. So I guess ADA users would have useful input on this. Have
> you found exact-width types to be useful, such that using a minimum width
> type instead would have been a problem?

It seems that Ada has everything... along with massive specifications. 
One thing that should be preserved in C (or its descendants) is its basic 
simplicity, but there's a fine line between simplicity and capability.

- Trung
Technical Details
Message-ID: <Pine.SUN.3.91.951001221337.4550B-100000@lagrange.uwaterloo.ca>
Path: arc1-ca.pugleaf.net!lagrange.uwaterloo.ca!vluu
References: <Pine.SUN.3.91.950929043656.23185A-100000@lagrange.uwaterloo.ca> <812502101snz@genesis.demon.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2,comp.lang.modula3,comp.lang.c,comp.lang.c++,comp.lang.ada
Path: arc1-ca.pugleaf.net!lagrange.uwaterloo.ca!vluu
From: Viet-Trung Luu <vluu@lagrange.uwaterloo.ca>
Subject: Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++) 
Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
Message-ID: <Pine.SUN.3.91.951001221337.4550B-100000@lagrange.uwaterloo.ca>
In-Reply-To: <812502101snz@genesis.demon.co.uk> 
Date: Mon, 2 Oct 1995 02:24:47 GMT
Content-Type: TEXT/PLAIN; charset=US-ASCII
References: <Pine.SUN.3.91.950929043656.23185A-100000@lagrange.uwaterloo.ca> <812502101snz@genesis.demon.co.uk> 
Nntp-Posting-Host: lagrange.uwaterloo.ca
Mime-Version: 1.0
Organization: University of Waterloo