Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Warning.-Array subscript is above array bonds



  • mat.push_back((valoresA[2]*valoresA[2]*cos(angulosTeta[1])*cos(angulosTeta[2]))+(valoresA[3]*cos(angulosAlfa[1])*cos(angulosAlfa[2])*cos(angulosAlfa[3]))-(valoresA[3]*cos(angulosAlfa[1])*sin(angulosAlfa[2])*sin(angulosAlfa[3]))), my program crashes after a few intents, I'm using the UI and calling this function from mainwindow.cpp, i have no errors, only this warning, it's a value stored in a vector<double> mat;


  • Lifetime Qt Champion

    Hi
    I have seen this if i use old c arrays and
    use them as parameter where i pass as pointer to first element.
    Its impossible to guess from the code snippet as it could be
    any of the valoresA, angulosTeta etc.

    You could split all the array access into variables, as it should show what
    line warning comes at.
    There is no other info in the warning ?

    ps. like this
    https://stackoverflow.com/questions/12785097/c-and-gcc-error-array-subscript-is-above-array-bounds


Log in to reply