|
> Excerpts from midrange: 8-Aug-98 MCH1210 Error in QEXCAFI John > Martz@us.ibm.com (2632*) > --------> Start rambling digression <------------ > ... The default behavior is that the hardware will detect an > attempt > to store a signed negative value into an unsigned variable. If > this happens, > exception MCH1210 is signalled. > For example, the following C code would probably run just fine on > a PC, but > will abend with MCH1210 on AS/400. > signed int a = -1; > unsigned int b; > b = a; /* MCH1210 -- ka-booom! *./ > --------> End of rambling digression <------------ Run-time detection of numeric overflow is a policy of a programming language. For example, the C sample code shown above will not abend with MCH1210 because the C language doesn't allow it. RPG ignores numeric overflow, too, but the compiler provides an option to detect it. COBOL ignores overflow unless ON SIZE is specified. ... All hardware platforms I am aware of provide some form of overflow detection. The usual technique is to set a condition code/register to reflect carry into and out the high order bit of the numeric result. If a run-time exception is required, extra instructions must be generated (by a compiler/translator) to test for overflow conditions and to post an exception. The PowerPC hardware works this way. The IMPI hardware is a little different -- some fixed-point instructions actually signal exceptions when overflow is detected. Bob Donovan, IBM Rochester, rjd@us.ibm.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.