Author Topic: Segmentation fault - what iis a Segmentation fault?  (Read 2289 times)

Seytra

  • Forum Addict
  • *
  • Posts: 2052
  • No system can compensate lack of common sense.
    • View Profile
(No subject)
« Reply #15 on: May 31, 2004, 11:46:30 pm »
If you\'re lucky, using a wild pointer gives you a plain segfault, if it actually goes out of your program\'s memory space.
If you\'re not, it\'ll stay inside and not do anything noticable at all, at least not immediately. Slow data corruption and / or strange behaviour / intermittant errors after changing totally unrelated things, maybe weeks later, cause much more of a headache... ;)

@ Androgos: I also love pointers. :)

Uyaem

  • Hydlaa Notable
  • *
  • Posts: 747
    • View Profile
(No subject)
« Reply #16 on: June 01, 2004, 08:32:21 am »
Quote
Originally posted by Androgos
Quote
Originally posted by Pogopuschel
alright, I\'ve been mostly programming with languages like Java/C# where there are no pointers and you cannot make such a mistake. ;)
So for me it\'s always the VM or the OS messing up memory pages, not myself *g*.

What do we learn from my previous reply? Don\'t drink and post...


No pointers? Hmm, what\'s the equal?


Nothing. Address handling there is done by the language itself. E.g. whenever you pass an object to a method it is not duplicated in memory, but instead it\'s offset address is used, so you can modify the object directly (No dereferencing chains of *).
The internet is "the terrorists'" most important weapon, they say.
Wrong.
Fear is their most important weapon.
Ours is our freedom.

dfryer

  • Veteran
  • *
  • Posts: 1070
    • View Profile
(No subject)
« Reply #17 on: June 01, 2004, 07:23:16 pm »
You really do have pointers in Java, but with all the sharp pointy edges sanded down :) You can\'t treat them as numbers and do math on them, or pass by reference,  and garbage collection is automatic (no more segfaults due to allocation/deallocation problems).  

The only thing that bugs me is the lack of pass-by-reference, but in some cases it enforces cleaner design.
Quidquid latine dictum sit, altum sonatur.