TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CAREY BLOODWORTH
from: F. TOURIGNY
date: 1997-07-26 14:21:00
subject: INTEGER OVERFLOW

 -=> Quoting Carey Bloodworth to F. Tourigny <=-
 CB> Realistically though, there isn't any decent way to check for integer
 CB> overflow.  Modern CPUs just aren't designed to do it, like FPUs do
 CB> with floating point numbers.  (Well, they do have an 'overflow' flag,
 CB> but there's no portable way to get to it, you'd have to use some inline
 CB> asm, and even then, you'd have to check it after each integer
 CB> operation, since its not 'signaled' like with FPU exceptions.)
 Then that's it.  I've picked a small program in an introductory
 course.  The author promised to get back later with his own solution
 but I couldn't find an answer anywhere in the book.
 Still, next time I write a compiler I'll make it a point to
 offer some way out in case a value wraps around INT_MAX
 and then INT_MIN :-)
  
   Frederic
   F_.Tourigny@juxta.mn.pubnix.net
--- Blue Wave/DOS v2.30 [NR]
---------------
* Origin: Juxtaposition BBS. Lasalle, Quebec, Canada (1:167/133)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.