× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Bob Cozzi wrote:
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Hans,

What I meant by being similar to other languages is that you specify the
variable and its type as an INT and you don't worry about the number of
digit it represents; during the declaration.

int
long
small
bigint
long long
etc.

Is better than 5i0 10i0 and 20i0

I can much more easily look at 4i and know what it means than know how
to code it than I can 10i0 or 5i0.
Well, I still say it's "half a dozen of one, six of the other".
Arguably, someone else may be more comfortable with a declaration
like 5I0 knowing that the variable can hold a 5 digit number.  After
all, it's often hard to relate byte size to maximum size of integer
number.  Basically, number of digits was chosen for integer and
unsigned numeric for the same reason that packed decimal numeric is
expressed in number of digits, and not number of bytes.

And in C, it's not always clear how big an int or long is, since
it's always implementation defined.  The only thing the C standard
says is that sizeof(short) <= sizeof(int) <= sizeof(long).
Typically, the size of int is defined by the word size of the
machine, but as far as I know, it doesn't really have to be.  For
example, the iSeries is a 64-bit machine, but C int's are still 32 bits.

Generally, though, 10I0 in RPG and int in C are sufficient for
holding most values needed in a program.  Worrying about specific
sizes is really only necessary for exceptionally large numeric
domains, and for data interchanges issues.

Personally, I like the Python approach.  If the result of an
expression yields a numeric value too large for a normal integer
object, a biginteger object is created to hold the result.  As a
result, you rarely get numeric overflow.  (Unfortunately, that can
only be done in an interpreted language.)

Cheers!  Hans





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.