Compiler seg fault

This is a discussion on Compiler seg fault within the C++ Programming forums, part of the General Programming Boards category; A sugestion... or not since your gcc is a bit old.. send your source to gcc bugzilla. Let's see if ...

  1. #16
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722
    A sugestion... or not since your gcc is a bit old.. send your source to gcc bugzilla. Let's see if that bug has already, or not, been corrected.

  2. #17
    Registered User
    Join Date
    May 2005
    Posts
    48
    I found that the seg fault occurs because of the function call, not because of the assignment. I changed it a bit so that:
    Code:
    double buffer = Score(actual, data);
    This causes the compiler to crash still.

  3. #18
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    I find these statements at odds.
    Quote Originally Posted by Buckshot
    actual is a struct passed by reference to the function, data is also a struct.
    I've checked to make sure that score is a member, and it is.
    The Score function's declaration looks like:
    Code:
    double Score(AEE addeff, datavar data);
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #19
    Registered User
    Join Date
    May 2005
    Posts
    48
    Whoa, thanks. Its supposed to be passed by reference. Missed the '&'.
    Thanks!
    However, I'm still getting the seg fault.
    The declaration was supposed to be:
    Code:
    double Score(AEE &addeff, datavar &data);
    Last edited by Buckshot; 06-16-2005 at 09:40 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting a seg fault
    By ammochck21 in forum C Programming
    Replies: 11
    Last Post: 01-23-2009, 04:27 AM
  2. next_permutation seg fault
    By zxcv in forum C++ Programming
    Replies: 9
    Last Post: 12-14-2008, 06:40 AM
  3. seg fault
    By hka26 in forum C++ Programming
    Replies: 1
    Last Post: 10-08-2007, 01:38 AM
  4. Found a seg fault, but can't explain why i get it
    By misplaced in forum C++ Programming
    Replies: 11
    Last Post: 08-29-2005, 02:58 AM
  5. seg fault with strcmp
    By samps005 in forum C Programming
    Replies: 2
    Last Post: 05-04-2003, 04:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21