Problems w/proc RETURNs
31-Dec-89 15:02:47
Sb: #14242-Problems w/proc RETURNs
Fm: Paul Whittemore 72007,3305
To: Avant-Garde Software 76004,2002
Hi Leon, follow-up to my previous message:
I turned range-checking off for a quick check and sure enough, it solved my
problem. The code worked correctly.
So I started thinking about the range error and decided that I should leave
range-checking on and fix the bug rather than band-aid it by turning the
checking off. So I checked the RETURN and found it was as follows:
RETURN tNum; where 'tNum' was declared via
CONST tNum = -5;
So I figured that I declared the procedure as a CARD or LONGCARD or something
but when I checked it was PROCEDURE : INTEGER. So as far as I can see, there's
no range error.
Now my best guess is that the compiler sign-extends CONSTs when they're
declared and tried to return -5D rather than -5. Does this sound plausible?
And is there some way in a CONST declaration to explicitly state that a
constant is a WORD (ala 'D' for LONGWORDs)?
Thanx again,
Paul Whittemore [72007,3305]