Author Topic: debugger segmentation error with vector[1]  (Read 2835 times)

floppyfreak

  • Guest
debugger segmentation error with vector[1]
« on: December 12, 2009, 04:39:11 pm »
I don't think this is a bug, but how can I manage this situation:
Code

bool TEclPrefIO::readPref()
{
    vector<std::string> nodenames;
    nodenames.push_back("sometext");
    if (nodenames.size()>1)

        std::string nix=nodenames[1];
return true;
}

int main()
{
    TEclPrefIO tio;
    if (!tio.readPref()) tio.writePref();
}



(the code is a bit rudimentary, but it should be enough to illustrate)

The debugger reacts now in such a way, that it does not even enter the readPref() but stops with a segmentation error. Is there something like a #ifdef to prevent this?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: debugger segmentation error with vector[1]
« Reply #1 on: December 12, 2009, 04:46:32 pm »
Your question is not related to C::B in any way, and therefore violates our forum rules.

This forum is dedicated to C::B related questions only and not to general programming questions.

Please ask your question in an appropriate (c++ dedicated ) forum.

Topic locked !!