C ++ 11中的用户定义属性? [英] User-defined attributes in C++11?

查看:125
本文介绍了C ++ 11中的用户定义属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有方法在C ++ 11或更高版本中创建用户定义的属性?



例如,

  [[noreturn]] void exit(); 

是编译器定义的C ++ 11属性。



我想定义如下:

  [[sentsoon]] int function 

是否有这种机制?



编辑:我应该提到我使用Clang。

解决方案

语言无法添加属性。

当然,如果你使用Clang,你可以编辑Clang的源码,并添加你喜欢的任何属性。


Is there a way to create user-defined attributes in C++11 or later?

For example,

[[noreturn]] void exit();

is a compiler-defined C++11 attribute.

I'd like to define something like:

[[comingsoon]] int function(int);

Is there a mechanism for this?

Edit: I should mention I'm using Clang.

解决方案

The language provides no way of adding attributes.

Of course, if you are using Clang, you can edit the source of Clang, and add any attributes you like.

这篇关于C ++ 11中的用户定义属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆