Please see below ...
Joe.
-----Original Message----- From: Frank D. Engel, Jr. [SMTP:fde101@yahoo.com] Sent: Friday, December 13, 2002 12:45 AM To: Frank Heckenbach; gpc@gnu.de Subject: Re: Bug? Identifier Integer sometimes fails
CONST maxint = 32767; (* redefine *) minint = -32768;
To be pedantic, you might want to write `MinInt = -MaxInt;' since the standard demands a symmetric range of Integer.
Uh...
'-MaxInt' would imply -32767..32767, which wastes a potential stored value (and cannot accomidate interfacing with other languages, which do not have this restriction).
'-MinInt' would imply -32768 (yes, negative; run the negation in 2's compliment and you will see what I mean).
By 'symmetric,' do you mean that the Pascal standard actually calls for the INTEGER type to have the same negative range as positive?
[Joe da Silva]
That's right, Pascal does NOT assume two's complement integer representation, so the standard range for an integer is -maxint to +maxint. Indeed, much of the early work on Pascal was done on CDC machines that had a sign & magnitude integer representation, hence this really was the range for integers. Although these days, two's complement integer implementations are all you are likely to encounter, in theory you should avoid -maxint-1 for portability. This value is a non-standard integer value, or a non-standard language extension, if you like. You may use it in that knowledge. Note that NW was quite happy for Pascal implementations to have whatever non-standard extensions were appropriate, he and KJ were only seeking to define a common, minimalist language, that all implementations must support.
=====
Frank D. Engel, Jr.
Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com