🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #232

CARDINAL and INTEGER number in Mod-2

#232
From: Ann Schwab
Date: Thu, 07 Sep 1989 23:38
18 lines
1411 bytes
I have just started taking a class in modula-2 and on our first project I 
noticed a small quirk with CARDINAL and INTEGER numbers.  When you are reading 
in a number from the keyboard it seems to work on all types of numbers and 
characters.  In doing some further research I found that when a negative number
was put into a CARDINAL field then it would return a 0 and the program would 
still keep going.  When a decimal number such as 9.87 or a series of characters
were entered then it would return a number between 2014 and 2020 and again it
kept on running.  I was trying my hardest to crash my program with invalid
input and I couldn't do it no matter how hard I tried.  Does anyone out there 
know why this was happening and how you can check to make sure that the number 
inputted is really a CARDINAL or INTEGER number and then have an error message 
register??
This same problem happened to the whole class and no one  knows why.    

Thanks in advance for any help that you can give.

Ann Schwab
in%"schwab@klaatu.canisius.edu"
Technical Details
Message-ID: <2470@canisius.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!sunybcs!canisius!schwab

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!sunybcs!canisius!schwab
From: schwab@canisius.UUCP (Ann Schwab)
Newsgroups: comp.lang.modula2
Subject: CARDINAL and INTEGER number in Mod-2
Message-ID: <2470@canisius.UUCP>
Date: 7 Sep 89 23:38:18 GMT
Organization: Canisius College, Buffalo N.Y. 14208
Lines: 18