multiplication-problem with BP7/need recommendation for pascal-compiler
For comparision, standard ISO 7185 Pascal rules are that all arithmetic
operations are carried out in the range of integer, which is
-maxint..maxint. In Borland Pascal integer is a 16 bit word, so maxint
is equal to 32767. longint (a non standard extention) is a 32 bit
quantity, which is why starting with a longint as a base gets your
job done.
integer being 16 bit is done for Borland for historical reasons. Integer
used to be 16 bit a long time ago, so it was kept at that size to
allow programs to remain "compatible".
The standard ISO 7185 idea of integer is for it to be the natural size
of numbers on a machine. While technically, that would allow integer
to be 0..10, the idea is that integer is the maximum size supported by
the machine efficiently, which would be 32 bits on a 80386 and beyond.
The idea that a program would become "incompatible" because the size
of integer was expanded, say from 16 to 32 bit, isn't supposed to
occur because programs either declare the range of numbers they use
specifically, or use integer and use the value of maxint to adjust
any program code to live with the larger (or smaller) range of integer.
So the short answer is that an ISO 7185 compatible compiler would not
typically have the problem you are describing. It is mainly due to
non-standard Pascal implementations.
--
Samiam is Scott A. Moore
Personal web site: http:/www.moorecad.com/scott
My electronics engineering consulting site: http://www.moorecad.com
ISO 7185 Standard Pascal web site: http://www.moorecad.com/standardpascal
Classic Basic Games web site: http://www.moorecad.com/classicbasic
The IP Pascal web site, a high performace, highly portable ISO 7185 Pascal
compiler system: http://www.moorecad.com/ippas
|