Clang error recovery

Brad Roberts braddr at slice-2.puremagic.com
Tue Apr 6 15:09:17 PDT 2010


On Tue, 6 Apr 2010, Walter Bright wrote:

> bearophile wrote:
> > Clang:
> > 
> > 
> > #include <inttypes.h>
> > int64 x;
> > 
> > 
> > t.c:2:1: error: unknown type name 'int64'; did you mean 'int64_t'?
> > int64 x;
> > ^~~~~
> > int64_t
> > 
> > -----------------
> > 
> > dmd:
> > 
> > I am not sure if this is the same situation:
> > 
> > alias uint uint64_t;
> > int foo(uint64 x) {
> >   return x * 2;
> > }
> > void main() {}
> > 
> > 
> > dmd prints:
> > 
> > temp.d(2): Error: identifier 'uint64' is not defined
> 
> dmd's spell checker only looks a distance of one, and uint64 is a distance of
> two from uint64_t. This is trivially changed, but I didn't do the longer
> distances because of the annoyances of false positives - variable name
> spelling doesn't work like english language spelling.
> 
> The issue is not, as has been suggested, that dmd doesn't do spelling checks
> on types.
> 
> There's really nothing "amazing" about a spell checker, it's just a better
> idea than not doing it.

Consider trying increasing distances (with some relatively low max).  If 
you hit a single suggestable correction, substitute it.  ie, for uint64, 
nothing at 0 or 1, one at 2 (uint64_t) so use it (but still error, 
obviously).

This could be particularly useful for simple 2 letter transpositions, if 
those are found by the checker.. a common thing for a lot of people for 
length, for instance.

Later,
Brad



More information about the Digitalmars-d mailing list