Hi,
the simple program below produces a segmentation violation when executed in CINT (CINT/ROOT C/C++ Interpreter version 5.16.16, November 24, 2006), but runs without problem when compiled.
The strange thing is that if I replace the loop in which change() is called by only a call to this function - so practically the same program - everything works, also in CINT.
Searching in the forum I have seen a few bug reports concerning std::vector, so probably the only solution at the moment is using the compiled program?
Tonio
#include <vector>
#include <iostream>
using namespace std;
void change(vector<int>& vec) {
vec[0]=1;
}
void test() {
vector<int> trace(10);
for (int i=0; i<trace.size(); i++) trace[i]=i;
for (int j=0; j<1; j++) change(trace);
}
int main() {
test();
}