flags - Assembly error handling -


i created function reading in decimal numbers in assembly, , want throwing exception if non-numeric character entered. idea set flag(s) accordingly, , handle these in main. flags best situation, , how set this/these?

on x86 architecture, carry flag (cf) has been historically used such purposes, because convenient manipulate: stc , clc instructions can used set , clear it. interrupt , direction flags (if, df) have similar instructions, altering these flags tends has significant impact on other code; direction flag, in particular, required various calling conventions set 1 way or another, , interrupt flag masks interrupts, visible effect should not depend on failure parse integer (for example).

while wouldn't compare proper exception throwing , handling, setting carry flag before return can indicate error, , caller can check carry flag (using jc instruction) on return handle error appropriately.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -