#include <iostream> using namespace std; int main(int argc, char** argv) { switch(argc) { case 0: int j = 0; std::cerr << "j: " << j << "\n"; break; case 1: int k = 1; std::cerr << "k: " << k << "\n"; break; default: std::cerr << "Empty.\n"; } return 0; }
Standard input is empty
prog.cpp: In function 'int main(int, char**)':
prog.cpp:10:8: error: jump to case label [-fpermissive]
case 1:
^
prog.cpp:7:7: note: crosses initialization of 'int j'
int j = 0;
^
prog.cpp:14:3: error: jump to case label [-fpermissive]
default:
^
prog.cpp:11:7: note: crosses initialization of 'int k'
int k = 1;
^
prog.cpp:7:7: note: crosses initialization of 'int j'
int j = 0;
^
Standard output is empty