home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18901 < prev    next >
Encoding:
Text File  |  1992-12-26  |  849 b   |  22 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!ecm
  3. From: ecm@casbah.acns.nwu.edu (Edward Malthouse)
  4. Subject: integer overflow
  5. Message-ID: <1992Dec26.184954.13812@news.acns.nwu.edu>
  6. Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
  7. Nntp-Posting-Host: unseen1.acns.nwu.edu
  8. Organization: Northwestern University, Evanston Illinois.
  9. Date: Sat, 26 Dec 1992 18:49:54 GMT
  10. Lines: 10
  11.  
  12. Is there any way of checking for overflows when doing integer arithmetic?
  13.  
  14. For example, suppose my compiler uses 2 byte short int's and I multiply two
  15. short int's and place the result in another short int but the product is 
  16. greater than 2^15.  Clearly the result will not be what I want.
  17.  
  18. Thank you in advance for your help.  Please e-mail responses and I will
  19. summarize if there is interest.
  20.  
  21. Ed Malthouse
  22.