Hello, I have this problem. I read the storage for a block (and thus for all "the things" inside it) are allocate after "{" of the block. Then I found this code below (thinking in c++ page 292 webEdition) that explain how to don't use jump and case (in such case). I uderstand:
1. the goto can't be there (otherwise I allocate storage but I could "not create" and initialize my1
2. Why is it ok? ( there is possible to skip My my2; )
3. With or without "case 2" My my3 are always skipped (then?)

I hope you'll understanding my troubles; thanks.
Qt Code:
  1. class My {
  2. public:
  3. My();
  4. };
  5.  
  6. My::My() {}
  7.  
  8. void p292 (int i) {
  9. if (i < 10) {
  10. //goto jump1; // I understand
  11. }
  12. My my1;
  13. jump1:
  14. switch (i) {
  15. case 10:
  16. My my2; // I don't understand
  17. break;
  18. //case 2: //with this it doesn't compile
  19. My my3; // (I don't understand)^2
  20. break;
  21. };
  22. }
To copy to clipboard, switch view to plain text mode