Page 1 of 1

Function callback problems

PostPosted: Sun Mar 24, 2002 6:00 pm
by samad_lotia
I have written a sorting function for an expandable array in C++. One parameter for the sorting function is a pointer to a function that the user supplies. This user-defined function compares individual elements in the array and is called many times throughout the lifespan of the sorting function. I noticed that sometimes the program crashes with a SIGBUS and sometimes it works fine with *no* change whatsoever with the code or anything else. The only change is that the comparison function's location in memory is changed, which is normal. Can anybody help me with this?