February 18, 2013
On 18/02/2013 01:30, Jonathan M Davis wrote:
> On Monday, February 18, 2013 01:04:41 Stewart Gordon wrote:
>> On 17/02/2013 20:07, Jonathan M Davis wrote:
>> <snip>
<snip>
>>> Implicit fallthrough is a warning when a case stament is non-empty, but if
>>> it's empty (as in the example), then there is no warning.
>>
>> What version of DMD are you using?
>
> That's irrelevant. I'm stating what the intended behavior is. If the compiler
> doesn't follow that behavior, then it's a bug.

So you meant to say "there is meant to be no warning".

<snip>
>> and there's a further anomaly in that it's an _error_
>> that's emitted only if _warnings_ are enabled.
>
> That's normal. That's what -w does. If you don't use any compiler flags, then
> you get no warnings. If you use -w, you get them, but they're treated as
> errors.

No, treatment as errors has nothing to do with the wording of compiler messages.  It's completely independent of this.  As I explained at 01:21 UTC.

> If you use -wi, then you get "informational warnings" which is what
> most everyone expects compilers to do normally - i.e. print the warning but
> not treat it as an error - but Walter Bright thinks differently about such
> things than many people, and his compilers often don't do what many people
> would consider normal. He doesn't believe in warnings in the first place.
> Rather, he thinks that everything should be an error or not as far as the
> compiler is concerned (which I very much agree with), but unfortunately, he
> gave in enough to create the -w flag (and eventually, the -wi flag), and when he
> did, he didn't follow the behavior of your average compiler, which has
> generated a fair bit of confusion with regards to warnings.
<snip>

Yes, Walter claimed early on that anything that compilers tend to emit warnings for ought to be forbidden by the language.  However, he hasn't followed this principle, and so we were left with the awkward situation whereby certain kinds of obviously buggy (or at least suspect) code are just silently accepted.

The "no warnings" philosophy we had for a while was also a detriment to one of D's other design goals, to have different compiler vendors competing on quality of implementation.

Still, for as long as the language spec is still under development, one might as well make suspicious code illegal rather than putting warnings in the reference implementation (unless there really is a point of contention in what should be legal).  But third party implementers don't have this recourse, so that's why warnings are useful.  Part of what makes a quality implementation is what warnings it generates.

Stewart.
February 19, 2013
On Sun, 17 Feb 2013 22:53:13 +0100
Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:

> On 2/17/13, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
> > Probably because -w turns warnings into errors. That's its whole schtick.
> 
> Really? Man this is confusing..
> 

The -w is just simply the "treat warnings as errors" switch (and of course it also implies "enable warnings").

Most compilers have an "enable warnings" switch and a "treat warnings as errors" switch. DMD is the same, it just treats "as errors" as the default instead of "as warnings" as the default.

That is perhaps a little backwards, but it's partly because DMD didn't used to even *have* the "-wi" switch and the ability to treat warnings *not* as errors. Then we talked^H^H^H^H^H^Hharrassed Walter into adding -wi, and being such a good sport he obliged :)

February 25, 2013
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.

Stewart.
February 25, 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
February 26, 2013
On 25/02/2013 02:01, Jonathan M Davis wrote:
<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.

So according to what you're saying, it's deliberate that -w doesn't compile D, but rather a vendor-specific language that is confusingly similar to D and admits some code that is legal in D with different behaviour.

Please supply a link to Walter's statement.

> The problem is really that -w exists at all.

Together with the omission of a switch that simply causes warnings to be emitted and then returns an error status if any were.

Stewart.
1 2 3
Next ›   Last »