学习目标-C.使用 Xcode 3.2.1.什么是错误:程序接收信号:“EXC_ARITHMETIC" [英] Learning Objective-C. Using Xcode 3.2.1. What is error: Program received signal: “EXC_ARITHMETIC”

查看:39
本文介绍了学习目标-C.使用 Xcode 3.2.1.什么是错误:程序接收信号:“EXC_ARITHMETIC"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Stephen Kochan 的优秀著作Objective-C 2.0 中的编程"来学习 Objective-C.我也是 Xcode 的新手.到目前为止,我所有的练习都运行良好,但是当我运行第 153 页的程序 7.6 FractionTest 时,我收到控制台消息程序收到信号:EXC_ARITHMETIC".状态显示程序成功,但我没有看到任何输出.有人可以建议我可能做错了什么吗?

I am learning Objective-C using Stephen Kochan's excellent book "Programming in Objective-C 2.0". I am new also to Xcode. So far all my exercises have worked fine, but when I run program 7.6 FractionTest on page 153 I get the console message "Program received signal: "EXC_ARITHMETIC". The status shows that the program succeeded, but I don't see any output. Can anybody suggest what I might be doing wrong?

推荐答案

检查分母是否为零(即被零除错误).

Check that if the denominator is zero (i.e. a divide-by-zero error).

EXC_ARITHMETIC (SIGFPE) 在 CPU 检测到无效计算时发出信号.一些原因包括被零除、整数溢出等,并且整数被零除最有可能是因为您正在实现 Fraction 类.

EXC_ARITHMETIC (SIGFPE) is signaled when the CPU detects an invalid calculation. Some causes include divide by zero, integer overflow, etc., and integer divide by zero is most likely the reason since you're implementing a Fraction class.

这篇关于学习目标-C.使用 Xcode 3.2.1.什么是错误:程序接收信号:“EXC_ARITHMETIC"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆