ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Воскресенье
28 апреля
53662
ReAl (12.03.2006 22:50, просмотров: 344)
Ещё немного о switch :-) Я тут зацепился глазами за то, что в стандарте по его поводу написано. Там упомянуто statement, а не compound statement. 4 Aswitch statement causes control to jump to, into, or past the statement that is the switch body, depending on the value of a controlling expression, and on the presence of a default label and the values of any case labels on or in the switch body. A case or default label is accessible only within the closest enclosing switch statement. По простому говоря - фигурные скобки необязательны :-) Правда, при этом внутрь statement меток не напихать, только перед... Т.е.
    switch(a)
    case 10:
    case 200:
        foo(a);
есть допустимая конструкция. И жрётся и BC5.02, и gcc, и кейлом 6.20