Skip to content

Commit

Permalink
improved #258
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed May 27, 2015
1 parent 6248a54 commit 73956f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ch05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ Colloquial term used to refer to the problem of how to process nested if stateme
```

```cpp
(a) Error: break lost
(a) // Error: should have a break statement
unsigned aCnt = 0, eCnt = 0, iouCnt = 0;
char ch = next_text();
switch (ch) {
case 'a': aCnt++; break;
case 'e': eCnt++; break;
default : iouCnt++; break;
}
(b) Error: variable ix defines inside the body of switch
(b) // Error: ix is not in scope.
unsigned index = some_value();
int ix;
switch (index) {
Expand All @@ -181,7 +181,7 @@ Colloquial term used to refer to the problem of how to process nested if stateme
ix = static_cast<int>(ivec.size())-1;
ivec[ ix ] = index;
}
(c) Error: case label syntax is wrong
(c) // Error: case label syntax error
unsigned evenCnt = 0, oddCnt = 0;
int digit = get_num() % 10;
switch (digit) {
Expand All @@ -192,7 +192,7 @@ Colloquial term used to refer to the problem of how to process nested if stateme
evencnt++;
break;
}
(d) Error: case label must be constant value
(d) // Error: case label must be a constant expression
const unsigned ival=512, jval=1024, kval=4096;
unsigned bufsize;
unsigned swt = get_bufCnt();
Expand Down

0 comments on commit 73956f5

Please sign in to comment.