Switch case falltrhough, regression or intended behavior ?

Jonathan M Davis jmdavisProg at gmx.com
Sun Feb 24 18:01:09 PST 2013


On Monday, February 25, 2013 01:42:10 Stewart Gordon wrote:
> On 18/02/2013 01:21, Stewart Gordon wrote:
> > On 17/02/2013 21:46, Jonathan M Davis wrote:
> <snip>
> 
> >> Probably because -w turns warnings into errors. That's its whole schtick.
> > 
> > No, the whole schtick of -w is that it causes warnings to be emitted at
> > all.  It's a quirk of the way it was designed that it treats them as
> > errors - by returning a failure status code, not by the wording of the
> > compiler output.
> 
> <snip>
> 
> There's a more important way in which it isn't quite "treat warnings as
> errors": if you use an IsExpression to test the validity of a snippet of
> code, a pass with warnings must still be a pass.  Otherwise, you'll get
> code that compiles with or without -w, but behaves differently in each
> case.  There have been bugs in DMD in this respect - I'm not sure if there
> still are.

That behavior is on purpose. It really is meant that the warnings be treated 
exactly as errors. I pointed out this particular issue to Walter in the past 
(within the past month even IIRC), and he agreed that it wasn't good, but it 
was clear from what he said that it was the intended behavior and not a bug. 
The problem is really that -w exists at all.

- Jonathan M Davis


More information about the Digitalmars-d mailing list