By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,110 Members | 1,010 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,110 IT Pros & Developers. It's quick & easy.

Bus Error?

P: n/a
Hi,
I have following 2 questions:

* What is bus error?
* How is it different from segmentation fault?

Thanks
--------------------------------------------------------------
"We approached the case, you remember Watson," said
Mr. Homles, "with an absolutely blank mind, which is
always an advantage."

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Mon, 29 Sep 2003 10:15:56 +0530, "Vijay Kumar R Zanvar"
<vi*****@hotmail.com> wrote in comp.lang.c:
Hi,
I have following 2 questions:

* What is bus error?
* How is it different from segmentation fault?

Thanks
--------------------------------------------------------------


Please use a proper signature separator in the future. As defined by
Internet RFCs, a proper signature separator is like mine, below. It
consists of a line containing exactly two hyphen characters followed
by a single blank space "-- ". It is not a matter of style but of
using the standard format that existing newsreaders recognize.

As for your question, the C standard does not define either "bus
error" or "segmentation fault", these are things that happen with your
particular compiler on your particular operating system.

In general, they are both the result of something wrong in your
program, an error that produces undefined behavior. When your program
generates undefined behavior C no longer specifies what might happen,
and things like "bus error" and "segmentation faults" are the results
of certain types of undefined behavior on your particular system.

To find out for sure you need to ask in a group that supports your
particular compiler/OS combination.

For several common such combinations, a segmentation fault results
when your program tries to access memory that does not belong to it,
for example with an uninitialized or null pointer, or writes past the
end of allocated memory. Bus faults generally result when you play
games with pointer conversions and access a variable using a pointer
with incorrect alignment.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #2

P: n/a
Vijay Kumar R Zanvar wrote:
Hi,
I have following 2 questions:

* What is bus error?
* How is it different from segmentation fault?

Thanks
--------------------------------------------------------------
"We approached the case, you remember Watson," said
Mr. Homles, "with an absolutely blank mind, which is
always an advantage."

Nov 13 '05 #3

P: n/a
Vijay Kumar R Zanvar wrote:
Hi,
I have following 2 questions:

* What is bus error? Bus error writing/reading something to memory location which is not
aligned, e,g, writing some int value at odd adress
* How is it different from segmentation fault? segmentaion error is writing/reading something beyond the address
space of a process.

Thanks
--------------------------------------------------------------
"We approached the case, you remember Watson," said
Mr. Homles, "with an absolutely blank mind, which is
always an advantage."

Nov 13 '05 #4

P: n/a
"Vijay Kumar R Zanvar" <vi*****@hotmail.com> wrote in message
news:bl************@ID-203837.news.uni-berlin.de...
Hi,
I have following 2 questions:

* What is bus error?
* How is it different from segmentation fault?


Neither of those terms is defined by the C language.

They're types of errors that some operating systems
can suffer. Check the documentation of the system
where you see those errors.

-Mike
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.