[ConceptGCC] |
ConceptGCC :Re: Concepts in std::string; default implementations |
From: Martin Sebor (sebor_at_[hidden])
Date: 2007-04-09 16:04:17
Doug Gregor wrote:
> On Apr 9, 2007, at 1:10 PM, Martin Sebor wrote:
>
>> Douglas Gregor wrote:
>> [...]
>>>> 3) Is the ';' needed after concept or concept_map? AFAIK no, but
>>>> in all
>>>> examples in the tutorial it's there.
>>> The ';' is optional after a concept or concept_map.
>> Out of curiosity, is it optional because gcc allows it or is it
>> in the grammar that way?
>
> The optional ';' is in the grammar.
>
>> (AFAIK, the current grammar doesn't allow
>> stray semicolons at namespace scope, e.g., after the closing brace
>> of a namespace block, and there are compilers out there that give
>> errors for violations).
>
> Right, and it causes unnecessary pain for users who don't understand
> why class definitions need to be followed by ';' but function
> definitions do not. So, we let ';' be optional after concepts and
> concept maps.
Good! It's a pain even for some users who do understand that.
We're forced to introduce bogus declarations just to be able
to terminate macros with semicolons. E.g.,
#if SOME_FEATURE_AVAILABLE
# define FOO some_feature
#else
# define FOO typedef void __bogus_typedef
#endif
FOO; // semicolon okay even when feature not available
FWIW, it would be nice to relax the rest of the grammar
as well and allow semicolon at namespace scope.
Martin