views:

140

answers:

1

I've been testing part of my code responsible for filling multimap object, when a weird error started to pop up:

int SetPortName(string ID, string Name)
    cout << "ID: " << ID << " Name: " << Name;
    ...
}

works fine under non-root user in FreeBSD 5.4, but crashes with "Bus error" while ran under root.

+2  A: 

The title mentions something about string's constructor, but since you don't show any code that calls a constructor, I'm forced to assume the problem is actually in the caller of this function, where two string objects would be constructed for the parameters. My guess is that one of your two actual parameters is a char*, and it's a null pointer. Use your debugger to investigate further.

Rob Kennedy
nice bit of psychic debugging.
Michael Burr