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