I have a code using switch function and it gives the following error
supersonic_ob.cc:177: error:
jump to case label
supersonic_ob.cc:158: error: crosses initialization of ‘LaGenMatDouble delta_QQ’
What does it mean?
This is a discussion on funny error within the C++ Programming forums, part of the General Programming Boards category; I have a code using switch function and it gives the following error supersonic_ob.cc:177: error: jump to case label supersonic_ob.cc:158: ...
I have a code using switch function and it gives the following error
supersonic_ob.cc:177: error:
jump to case label
supersonic_ob.cc:158: error: crosses initialization of ‘LaGenMatDouble delta_QQ’
What does it mean?
It means that the initializasion of LaGenMatDouble delta_QQ is done in one case and probably used in other...
You should place braces around case where the declaraton of the LaGenMatDouble delta_QQ is done
The first 90% of a project takes 90% of the time,
the last 10% takes the other 90% of the time.
It's complaining because you might have writen code that looks like this, which wont print 42 when foo is 2 because it skipped over the line where foobar gets its value.
I thought that this usually only gave a warning though.By putting braces around the code in case 1, foobar is no longer in scope in case 2 and the problem becomes obvious, and you definitely get an error.Code:switch (foo) { case 1: int foobar = 21; cout << foobar; case 2: cout << foobar*2; break; }
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"