On 1 September 2012 19:08, Dmitry Olshansky <dmitry.olsh@gmail.com> wrote:
On 01-Sep-12 19:58, Peter Alexander wrote:
C:

int mul(int x, int y);


Future D:

pure @safe nothrow nogc commutative associative distributive
@forceinline mayoverflow int mul(int x, int y);


No it's GNU C++ of today just replace 'pure' with __attribute__((pure))
and you are done :)
And don't even get me started at MS extensions...

Either way this is a kind of thing that only some users need but std library have to use all of them just so that those 'some users' can use it.

In fact if pure @safe nothrow could be combined in a user defined tag:

alias pure @safe nothrow nogc nice_func;

nice_func int mul(int x, int y);

and even C has it via macros, damn...

Aside the context of this thread, this would actually be REALLY useful. I think I've asked about it a few times before.
There is already a fairly annoying problem where GDC supports GNU attributes that DMD doesn't know about, which are basically impossible to use; there's no nice way to use compiler-specific attributes without some sort of alias like this.
I think the only current way is to duplicate the definitions in different version blocks.
An attribute alias would be super handy, particularly when abstracting support for multiple compilers.