Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #9385
| Message-ID | <1952509.RcUan3lTt2@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2011-12-18 23:09 +0100 |
| Subject | Re: Break for last case in switch |
| Newsgroups | comp.lang.javascript |
| References | <758d8d3d-1b7d-46a8-8dc7-8f5764138efc@q16g2000yqn.googlegroups.com> <fbidncC--v1e33PTnZ2dnUVZ8sWdnZ2d@giganews.com> <2014557.oCFFeib8bu@PointedEars.de> <f5qdnf4Rs5HfyXPTnZ2dnUVZ8v-dnZ2d@giganews.com> <3028473.Ge26DHhYnv@PointedEars.de> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>> Thomas 'PointedEars' Lahn wrote:
>>> Stefan Weiss wrote:
>>>> JavaScript Lint is mistaken.
>>> You are mistaken.
>>
>> No. Please re-read what I wrote. I said:
>
> Please re-read what you have replied to in the first place.
>
>>>> A 'break;' at the end of the last clause in a switch statement would be
>>>> redundant.
>>
>> I did _not_ say "at the end of the default clause".
>
> The "last case" in the original code is the `default' clause. ISTM *that*
> was here the missing `break' statement was being warned about. Rather
> ambiguously for sure, but there it was.
And regardless of the misconceptions of a well-known wannabe, that is
exactly what happened here.
<http://www.javascriptlint.com/online_lint.php> shows *two* warnings for
this code –
Line 3, column 1: "lint warning: missing semicolon"
Line 8, column 1: "lint warning: missing break statement for last case in
switch"
– while, if the `break' statement in the last `case' clause is omitted, it
shows *three* warnings:
Line 3, column 1: "lint warning: missing semicolon"
Line 6, column 9: "lint warning: missing break statement"
Line 8, column 1: "lint warning: missing break statement for last case in
switch"
So it is not a bug, it is a feature. A questionable feature because it uses
ambiguous wording, but there it is.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Break for last case in switch Archos <raul.san@sent.com> - 2011-12-18 11:04 -0800
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-18 20:43 +0100
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-18 22:13 +0200
Re: Break for last case in switch Antony Scriven <adscriven@gmail.com> - 2011-12-18 12:21 -0800
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-18 21:37 +0100
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-18 21:58 +0100
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-18 22:29 +0100
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-18 23:49 +0200
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-18 23:09 +0100
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-19 00:32 +0200
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-18 23:25 +0100
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-19 00:06 +0100
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-19 05:30 +0100
Re: Break for last case in switch Andrew Poulos <ap_prog@hotmail.com> - 2011-12-19 16:04 +1100
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-19 12:25 +0100
Re: Break for last case in switch "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-19 17:17 +0000
Re: Break for last case in switch Gene Wirchenko <genew@ocis.net> - 2011-12-19 12:19 -0800
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-19 14:47 +0200
Re: Break for last case in switch John G Harris <john@nospam.demon.co.uk> - 2011-12-19 15:50 +0000
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-19 18:45 +0200
Re: Break for last case in switch Gene Wirchenko <genew@ocis.net> - 2011-12-19 12:22 -0800
csiph-web