?
Solved

Exception/bus error

Posted on 2004-09-13
5
Medium Priority
?
422 Views
Last Modified: 2010-04-15
Hi All,

I would like to know the difference between an exceptiona nd bus error. Maybe some examples would be of help.

Another(out of context) question : Is it necessary to have a 'ile system' for printf( ) to work ?

Thanks,
Arut
0
Comment
Question by:arut
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12042038
There are a number of exceptions, but just an example: zero-divide. And a bus-error could be the use of an address (by means of a pointer or array) that isn't in your dataspace, i.e. that isn't accessible by your program.

If you are on linux/unix, try man 2 signal, or use Google searching for "man signal linux"
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12042133
A fatal failure in the execution of a machine language instruction resulting from the processor detecting an anomalous condition on its bus. Such conditions include invalid address alignment (accessing a multi-byte number at an odd address), accessing a physical address that does not correspond to any device, or some other device-specific hardware error. A bus error triggers a processor-level exception which Unix translates into a "SIGBUS" signal which, if not caught, will terminate the current process.

http://computing-dictionary.thefreedictionary.com/bus%20error
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12042153
Bus error is a kind of exception ... There are several exceptions including but not limited to what sjef_bosman said

"And a bus-error could be the use of an address (by means of a pointer or array) that isn't in your dataspace, i.e. that isn't accessible by your program."
Is segmentation fault but not bus error .. I do not thing divide by zero is a bus error either .. that should be arithmetic or floating point exception
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 375 total points
ID: 12042187
Another way of putting it

There's a subtle difference between "segmentation fault" and "bus error". A "bus error" means that the kernel didn't detect the problem on its own; the memory system (i.e. hardware) realized that there was a problem.
http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/CommonFAQ/SGIErrors.html#buserror

Some processors generate fault when you try to access non aligned memory, bus error is generally an indication of that condition
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12042286
Too subtle for me... I  must admit that "Bus Error - Core dumped" reminds me of the PDP-11 series, which indeed had word-alignment.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question