-=> Quoting Mathieu Bouchard to Darin Mcbride
NH>> switch (foo) {
NH>> case 1 :
NH>> int bar = 2;
NH>> break;
NH>> case 2 :
NH>> int bar = 3;
NH>> break;
NH>> }
DM> What are the compiler errors? IIRC, without jumping around to my
DM> compilers,
DM> I believe you'd get something along the lines of jumping over the
DM> initialization of bar. If you'd rename them to bar1 and bar2, you'd
DM> notice
DM> that your case 2 jumps past the initialization of bar1. That's because
DM> switch is basically a glorified goto - and bar1 is still in scope at
ase
MB> in C/C++, lack of initialization is not an error. the error is that
MB> there are two identical variable names.
Nope... both are errors. Have you tried it on your compiler before posting,
or did you just post? Try compiling an example, first...
... If you expect nothing, you won't be disappointed.
--- FastEcho 1.46
---------------
* Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536)
|