More Clang diagnostic

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 25 19:25:42 PDT 2010


On 10/25/10 21:12 CDT, Michel Fortin wrote:
> On 2010-10-25 21:01:49 -0400, Walter Bright <newshound2 at digitalmars.com>
> said:
>
>> bearophile wrote:
>>> Another diagnostic feature is to not just use the caret (we have
>>> discussed about it time ago) but it also underlines the wrong part:
>>>
>>> t.c:7:39: error: invalid operands to binary expression ('int' and
>>> 'struct A')
>>> return y + func(y ? ((SomeA.X + 40) + SomeA) / 42 + SomeA.X : SomeA.X);
>>> ~~~~~~~~~~~~~~ ^ ~~~~~
>>
>> Yes, we discussed it before. The Digital Mars C/C++ compiler does
>> this, and NOBODY CARES.
>> Not one person in 25 years has ever even commented on it. Nobody
>> commented on its lack in dmd.
>> It's a waste of time to implement things nobody cares about.
>
> With the above error message, when you go to the next error within
> Xcode, it puts the text insertion caret right where the error caret is.
> I've found in the last few months using Clang that this behaviour of
> Xcode saves me from hitting a lot the arrow keys when correcting errors
> because I'm already closer to where the error happened. That's even more
> true when the same error is repeated multiple times and I can machinery
> repeat the same fix. I actually miss the feature when I compile
> something with GCC using Xcode, because GCC provides only the line
> number and all Xcode can do is select the line.
>
> It's true that by itself, on the command line, this feature isn't
> terribly useful. But for better integration with Xcode (or any IDE for
> that matter), I'd like it very much if dmd printed the column number for
> the caret in addition to the line. It's not a very important feature,
> but just a "nice touch" that makes things a little better.

This is odd. I'd find if difficult to picture that. So the compiler puts 
the cursor exactly where it _thinks_ the error occurred. More often than 
not that's not even the locus of the actual error, and even if it were, 
I'd find it a stretch to say that that would improve my responsiveness.

Andrei


More information about the Digitalmars-d mailing list