• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Exception on a simple arithmetic problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception on a simple arithmetic problem


  • Subject: Re: Exception on a simple arithmetic problem
  • From: Bruce Hammond <email@hidden>
  • Date: Fri, 20 Jan 2006 11:11:16 -0800

Peter,

The x86 CPU may, depending on configuration, generate exceptions for any read of a floating point value before it is initialized such as.

double a;
double b=a;   // possible exception.

This may or may not be happening to you, but on a project I worked on several year ago, we found many such bugs when porting a large code base from BeOS-PowerPC to Windows.

They were nasty to find since the exceptions only happened if the right garbage was in the uninitialized variable.

It can help to turn on the appropriate warnings in Xcode.

Cheers,
--
BQ Hammond
Font Management Engineering
Extensis, Inc. A Celartem Company
Empowering digital assets
http://www.extensis.com/
Phone: 503.274.2020 x228
E-mail: email@hidden

Notice: This communication may contain privileged or other confidential information. If you are not the intended recipient, or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, or otherwise use the information. Also, please indicate to the sender that you have received this email in error, and delete the copy you received. Thank you.









Peter wrote:

This happen during debugging my C code under XCode, compiled for Intel platform,

double fVal, fTemp;

fTemp = filesize; /* filesize is a long long and is greater than 0 */
fVal = 100.0 / (double) fTemp; /* EXC_ARITHMETIC happens here */


The debugger stop and throws EXC_ARITHMETIC message at the calculation line. When the program is in release mode(compile with - O2), this problem never happens during runtime. I am using OS 10.4.3 (8F1111).

What condition makes EXC_ARITHMETIC exception to be thrown under Pentium ?

There was never an exception of this kind happen when I am doing PowerPC debugging. I am already missing PowerPC Macs.

Thanks in advance.

Peter.



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Exception on a simple arithmetic problem
      • From: Eric Albert <email@hidden>
References: 
 >Exception on a simple arithmetic problem (From: Peter <email@hidden>)

  • Prev by Date: Re: Exception on a simple arithmetic problem
  • Next by Date: Re: Changing default path for svn
  • Previous by thread: Re: Exception on a simple arithmetic problem
  • Next by thread: Re: Exception on a simple arithmetic problem
  • Index(es):
    • Date
    • Thread