[patch] Render anonymous entities with "(anonymous thing)" rather than "<anonymous thing>"

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Wed Mar 12 17:25:08 PDT 2014


Ah, if only C++ hadn't already soaked up every possible delimiter-pair
((), [], {}, <>, [[]], and in various extensions <<<>>>, ({}), (()),
...). No matter what you pick, it'll collide with *some* C++ syntax.

Insert obligatory Unicode proposal here. ;)

FWIW (not much), I like David's original proposal of ()s instead of
<>s, because IF the goal is to avoid user-confusion, and IF we
postulate that the user-confusing-est error messages tend to come from
deeply nested templates, then <>s are worse than ()s.

–Arthur


On Wed, Mar 12, 2014 at 4:58 PM, David Majnemer
<david.majnemer at gmail.com> wrote:
> FYI, GCC seems to use curly braces for some diagnostics:
>
> given:
> namespace { int x; }
> namespace { int x; }
>
> GCC outputs:
> error: redefinition of ‘int {anonymous}::x’
>
> Personally, I like the curly braces more than the parens.
>
> Just my two cents on the issue.
>
> On Wed Mar 12 2014 at 4:51:39 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>>
>> On Tue, Mar 11, 2014 at 12:08 AM, David Blaikie <dblaikie at gmail.com>
>> wrote:
>>>
>>> Partly out of consistency with GCC's anonymous namespace rendering
>>> ("(anonymous namespace)") and just a desire not to have angle brackets
>>> be confused with a template argument list, this patch changes all our
>>> anonymous things to use parens.
>>>
>>> Not entirely consistent with GCC (GCC still uses angles for
>>> "<anonymous struct>" and other cases), but Chandler and Richard seemed
>>> to prefer consistency between the different kinds of names, rather
>>> than consistency with GCC here.
>>>
>>> I haven't added an actual debug info test, though that was my initial
>>> motivation - I can add one if someone thinks that's valuable.
>>>
>>> Any other thoughts?
>>
>>
>> Looking through the testcase updates, my gut reaction is that I find the
>> ()s uglier than the <>s (maybe because it's more obvious that the <>s are
>> not real language syntax?)... but I'm sure I'll get over it :)
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list