Bus Error?

  • Thread starter Vijay Kumar R Zanvar
  • Start date
V

Vijay Kumar R Zanvar

Hi,
I have following 2 questions:

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

Thanks
 
J

Jack Klein

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
 
G

Ganesh Kundapur

Vijay said:
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.
 
M

Mike Wahler

Vijay Kumar R Zanvar said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

C error messages 7
bus error 7
bus error 5
Bus error because of casting? 8
8 buttons ,3 states and PJON Arduino 0
The cost of the cheapest routes between cities 3
Bidirectional bus connection 0
bus error 9

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top