NH> However, if I write the code this way there are no errors:
NH> switch (foo) {
NH> case 1 : {
NH> int bar = 2;
NH> break;
NH> }
NH> case 2 : {
NH> int bar = 3;
NH> break;
NH> }
NH> }
NH> I was under the assumption that the braces weren't necessary in C++
NH> far as declaring variables is concerned. Why then do I need the
NH> braces? Do the added braces affect portability in any way?
Yes, only correct code is portable :-)
What's your problem with writing two additional characters? Does it
help you if I tell you that well designed code doesn't contain many
switch statements?
Thomas
---
þ MM 1.0 #0113 þ That light at the end of the tunnel is a train....
---------------
* Origin: McMeier & Son BBS (2:301/138)
|