blog post about clang diagnostics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

blog post about clang diagnostics

Chris Lattner
FYI, it's been too long since we've had a blog post, so I wrote this up tonight:
http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html

Thoughts and comments welcome!

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: blog post about clang diagnostics

James Widman

On Apr 6, 2010, at 2:36 AM, Chris Lattner wrote:

> FYI, it's been too long since we've had a blog post, so I wrote this up tonight:
> http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html
>
> Thoughts and comments welcome!

Apologies in advance, because I know I'm being pedantic, *but*...

You wrote:
> [...] if you comment out the two
> using directives in the example above [...]

Many seasoned C++ programmers get this terminology wrong.

The aforementioned things in the example:

  using B1::f;  using B2::f;

... are using-declarations, not using-directives.  This might help to keep it straight:

A using-declaration is a *declaration* in the sense that it *declares* (introduces) a name in the scope where it appears.

A using-directive is not a declaration *at all*, and it doesn't introduce any names in the scope where it appears.  It is a *directive* in the sense that it sort of *tells name lookup to behave differently* (whereas a declaration tends to alter just the input to name lookup but not the behavior).

And a using-directive always names a *namespace*.

 namespace N{}
 using namespace N; // ok

 namespace Q{ void f(); }
 using namespace Q::f(); // error (expected a namespace name)

... whereas a using-declaration can name just about anything that can be named with a qualified-id (with the exception of a template-id (grammar term)).

James Widman  
--
Gimpel Software
http://gimpel.com




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: blog post about clang diagnostics

Chris Lattner
fixed thanks.

On Apr 13, 2010, at 8:31 AM, James Widman wrote:

>
> On Apr 6, 2010, at 2:36 AM, Chris Lattner wrote:
>
>> FYI, it's been too long since we've had a blog post, so I wrote this up tonight:
>> http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html
>>
>> Thoughts and comments welcome!
>
> Apologies in advance, because I know I'm being pedantic, *but*...
>
> You wrote:
>> [...] if you comment out the two
>> using directives in the example above [...]
>
> Many seasoned C++ programmers get this terminology wrong.
>
> The aforementioned things in the example:
>
>  using B1::f;  using B2::f;
>
> ... are using-declarations, not using-directives.  This might help to keep it straight:
>
> A using-declaration is a *declaration* in the sense that it *declares* (introduces) a name in the scope where it appears.
>
> A using-directive is not a declaration *at all*, and it doesn't introduce any names in the scope where it appears.  It is a *directive* in the sense that it sort of *tells name lookup to behave differently* (whereas a declaration tends to alter just the input to name lookup but not the behavior).
>
> And a using-directive always names a *namespace*.
>
> namespace N{}
> using namespace N; // ok
>
> namespace Q{ void f(); }
> using namespace Q::f(); // error (expected a namespace name)
>
> ... whereas a using-declaration can name just about anything that can be named with a qualified-id (with the exception of a template-id (grammar term)).
>
> James Widman  
> --
> Gimpel Software
> http://gimpel.com
>
>
>


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev