samad_lotia
Registered
I have written a sorting function for a resizeable array object in C++. The sorting function requires a pointer to a user-defined comparison function to be passed as a parameter. I noticed that sometimes the program crashes with a SIGBUS and sometimes it works fine without any changes to the program or environment whatsoever. I think what is going on is that the user-defined function's memory location changes, being totally normal, and when the function described by the pointer is executed, it finds out the pointer is not valid and crashes. Here are two example pointer values to the user-defined function:
0x3008 (This one works just fine)
0x6 (This doesn't work. That's quite obvious)
Anybody can help me out with this?
0x3008 (This one works just fine)
0x6 (This doesn't work. That's quite obvious)
Anybody can help me out with this?