Should compilers take advantage (abuse) of the new UDA syntax that has been accepted?

Peter Alexander peter.alexander.au at gmail.com
Tue Dec 18 11:23:17 PST 2012


On Tuesday, 18 December 2012 at 19:08:06 UTC, deadalnix wrote:
> On Tuesday, 18 December 2012 at 16:47:37 UTC, Peter Alexander 
> wrote:
>> On Tuesday, 18 December 2012 at 16:43:53 UTC, Peter Alexander 
>> wrote:
>>> On Tuesday, 18 December 2012 at 15:19:58 UTC, Iain Buclaw 
>>> wrote:
>>>> Should we take this as an opportunity for other compiler 
>>>> maintainers to implement their own compiler-specific 
>>>> predefined attributes?
>>>
>>> Please, no!
>>
>> Before anyone says "that would never happen", consider that 
>> C++11 was forced to use 'decltype' instead of the more natual 
>> 'typeof' because GCC already added 'typeof' as an extension. 
>> The same thing happened with the containers. GCC added 
>> stdext::hash_map as an extension, so C++11 had to use the ugly 
>> std::unordered_map (yep, even the different namespace didn't 
>> help).
>
> Can you explain why it was an issue in the unordered_map case ? 
> Because of using ?

Most probably yes. using namespace std, and using namespace 
stdext are all too common. You can't afford to break that code 
when you update a language as large as C++.

> I think this should be advertised that such a feature is in 
> some GDC's specific module, and that it can clash with any 
> library symbol at any time, as it is not a standardized feature 
> of the language.

Doesn't matter whether you advertise it as experimental or not. 
As we've just seen with Remedy Games and UDAs, as soon as someone 
starts using it in production, whether it's experimental or not, 
you have to support it. That's life.


More information about the Digitalmars-d mailing list