pu$�le
strtr
strtr at sp.am
Sun Jul 18 19:14:11 PDT 2010
== Quote from Jonathan M Davis (jmdavisprog at gmail.com)'s article
> On Sunday 18 July 2010 17:36:58 strtr wrote:
> >
> > I don't agree with this bug report because of two reasons.
> > 1. Warnings are supposed to be warnings, not errors. If you want to see
> > those warnings you'll use -w.
> > What you probably want is for the dmd to have a -!w flag instead (warnings
> > by default, disable with flag)
> > 2. In this particular example, the problem is not that the warning isn't
> > shown without -w, but that the warning is incorrect and scope(failure)
> > shouldn't be able to catch the exception.
> >
> > Here is a smaller example of the same problem[D1]:
> > ----
> > void main()
> > {
> > for(int i=0;i<10;i++)
> > {
> > scope(failure){
> > writefln("continue");
> > continue;
> > }
> > //scope(failure) writefln("fail");
> > writefln(i);
> > throw new Exception(format(i));
> > }
> > }
> > ----
> >
> > Enable warnings and you'll get the same unreachable warning, but which
> > statement is unreachable as when you compile this without -w it happily
> > prints all ten i's and continues.
> With any other compiler that I've ever used, it prints warnings normally. It may
> or may not have a way to make then errors, but it will print them normally and
> compile with them. dmd won't display warnings with -w, but when you use -w, it
> instantly makes them errors. There needs to be a middle ground where warnings
> are reported and not flagged as errors.
I would use this middle ground by default, if available.
> As for unreachable code being an error, that's debatable. Obviously, dmd doesn't
> consider it one. Personally, I hate the fact that javac does with Java. I _want_
> that to be a warning. I'd like to be warned about it, and I don't want it to be
> in production code, but it happens often enough when developing, that I don't
> want to have to fix it to get code to compile. As such, a warning makes perfect
> sense.
I'm not sure whether you missed my point or are simple thinking out loud about
unreachable code being a warning.
My point was that the unreachable warning was wrong as there is no unreachable code.
> However, when you combine that with the fact that dmd doesn't even report
> warnings unless it treats them as errors, it becomes easy to miss.
> - Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list