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:
class My { public: My(); }; My::My() {} void p292 (int i) { if (i < 10) { //goto jump1; // I understand } My my1; jump1: switch (i) { case 10: My my2; // I don't understand break; //case 2: //with this it doesn't compile My my3; // (I don't understand)^2 break; }; }To copy to clipboard, switch view to plain text mode
Bookmarks